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
5
2 4 7 8 10
output
3
input
4
1 2 1 1
output
2

题解:一组数只有一个奇数或者偶数,输出它的位置.
 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
const int N=;
const int mod=1e9+;
int a[N];
int main()
{
int n;
while(cin>>n){
int i,flag1,flag2,sum1=,sum2=;
for(i=;i<n;i++){
cin>>a[i];
if(a[i]%==){
flag2=i+;
sum2++;
}
else {
flag1=i+;
sum1++;
}
}
if(sum1>&&sum2>){
if(sum1==) cout<<flag1<<endl;
else cout<<flag2<<endl;
}
}
return ;
}
 
05-29 01:16