Algorithm


A. IQ test
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he needs a program that among the given n numbers finds one that is different in evenness.

Input

The first line contains integer n (3 ≤ n ≤ 100) — amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.

Output

Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.

Examples
input
Copy
5
2 4 7 8 10
output
Copy
3
input
Copy
4
1 2 1 1
output
Copy
2



 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <iostream>
#include <vector>

using namespace std;

int countEven(vector<int> arr) {
	int evens = 0;
	for(int i = 0; i < arr.size(); i++)
		if(arr[i] % 2 == 0)
			evens++;
	return evens;
}

int main() {
	int t;
	cin >> t;
	vector<int> arr(t);

	for(int i = 0; i < t; i++) {
		cin >> arr[i];
	}

	int evens = countEven(arr);

	if(evens == 1) {
		for(int i = 0; i < arr.size(); i++)
			if(arr[i] % 2 == 0)
				cout << i + 1 << endl;
	} else {
		for(int i = 0; i < arr.size(); i++)
			if(arr[i] % 2 != 0)
				cout << i + 1 << endl;
	}

	return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5
2 4 7 8 10

Output

x
+
cmd
3
Advertisements

Demonstration


Codeforcess SOlution A. IQ test C,C++, Java, Js and Python ,A. IQ test,IQ test,Codeforcess SOlution

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+