/*
Ashutosh Singla <ashu1461@gmail.com>
Algorithm:
#tags:
date: Sat Dec 14 00:34:48 IST 2013
*/

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<climits>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long LL;
#define FL(a) memset(a, 0, sizeof a);
#define fill(a,v,N) memset(a, v, sizeof(a[0])*N)
#define sz(a) int((a).size())
#define pb push_back
#define si(n) scanf("%d",&n)
#define sin(n) scanf("%d\n",&n) // for scanning strings ..
#define sill(n) scanf("%lld",&n)
#define pi(n) printf("%d\n",n);
#define pill(n) printf("%lld\n",n);
#define pis(n) printf("%d ",n);

#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())  // map and set find ..
#define cpresent(c,x) (find(all(c),x) != (c).end())  // stl find ..
#define FREP(b) for(int i=0;i<b;i++)
#define FREPr(b) for(int i=b-1;i>=0;i--)
#define REP(a,b,c) for(int a=b;a<c;a++)
#define REPr(a,b,c) for(int a=b;a>b;a--)
#define mp(a,b) make_pair(a,b);
typedef pair<int, int> ii;
#define MAX_S 100007

struct data{
    int u,v,w;
    data(int U, int V, int W): w(W), u(U), v(V) {}
    data(){}
};
bool operator < (const data &a1, const data &a2){
    if(a1.u == a2.u) return a1.v < a2.v;
    return a1.u < a2.u;
}
set<data> ans;
struct T{
    int w, in;
    T(int W, int i) : w(W), in(i) {}
    T() {}
};
bool operator < (const T &a1, const T &a2){
    if(a1.w == a2.w) return a1.in < a2.in;
    return (a1.w < a2.w) ;

}
vector<T> one;
set<T> zero;
vector<int> z[8];
void handle(int, int);
void handlezero();
int in[8];
int main()
{
    int n;
    si(n);
    int w,type;
    FREP(n){
        si(type);si(w);
        in[type] = i;
        if(w == 0){
            z[type].pb(i);
            continue;
        }
        if(type == 0)
            zero.insert(T(w,i));
        else
            one.pb(T(w,i));
    }
    sort(one.begin(), one.end());
    FREP(one.size()){
        handle(one[i].w, one[i].in);
    }
    handlezero();
    set<data> :: iterator it;
    for(it = ans.begin(); it!=ans.end(); it++){
        pis(it->u+1);pis(it->v+1);pi(it->w);
    }
    return 0;
}
void handlezero(){
    FREP(z[1].size()){
        if(in[0] > z[1][i])
            ans.insert(data(in[0], z[1][i], 0));
        else ans.insert(data(z[1][i], in[0], 0));
    }
    FREP(z[0].size()){
        if(in[1] > z[0][i])
            ans.insert(data(in[1], z[0][i], 0));
        else ans.insert(data(z[1][i], in[1], 0));
    }
    return;
}
set<T> pi;
void handle(int we, int I){
    set<T>:: iterator it = zero.begin(), it2;
    while(it!=zero.end()){
        int mini = min(we, it->w);
        if(I > it->in)
            ans.insert(data(I, it->in, mini));
        else ans.insert(data(it->in, I, mini));
        we -= mini;
        if(it->w - mini!=0){
            int a = it->w-mini, b = it->in;
            pi.insert(T(a, b));
        }
        it2 = it;
        it++;
        zero.erase(it2);
        if(we == 0) break;
    }
    for(it = pi.begin(); it!= pi.end();it++){
        zero.insert(T(it->w, it->in));
    }
    pi.clear();
    return ;
}


/*
Ashutosh Singla <ashu1461@gmail.com>
Algorithm:
#tags:
date: Sat Dec 14 00:34:48 IST 2013
*/

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<climits>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long LL;
#define FL(a) memset(a, 0, sizeof a);
#define fill(a,v,N) memset(a, v, sizeof(a[0])*N)
#define sz(a) int((a).size())
#define pb push_back
#define si(n) scanf("%d",&n)
#define sin(n) scanf("%d\n",&n) // for scanning strings ..
#define sill(n) scanf("%lld",&n)
#define pi(n) printf("%d\n",n);
#define pill(n) printf("%lld\n",n);
#define pis(n) printf("%d ",n);

#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())  // map and set find ..
#define cpresent(c,x) (find(all(c),x) != (c).end())  // stl find ..
#define FREP(b) for(int i=0;i<b;i++)
#define FREPr(b) for(int i=b-1;i>=0;i--)
#define REP(a,b,c) for(int a=b;a<c;a++)
#define REPr(a,b,c) for(int a=b;a>b;a--)
#define mp(a,b) make_pair(a,b);
typedef pair<int, int> ii;
#define MAX_S 100007

struct data{
    int u,v,w;
    data(int U, int V, int W): w(W), u(U), v(V) {}
    data(){}
};
vector<data> ans;
struct T{
    int w, in;
    T(int W, int i) : w(W), in(i) {}
    T() {}
};
bool operator < (const T &a1, const T &a2){
    if(a1.w == a2.w) return a1.in < a2.in;
    return (a1.w < a2.w) ;

}
vector<T> one;
set<T> zero;
vector<int> z[8];
void handle(int, int);
void handlezero();
int in[8];
int main()
{
    int n;
    si(n);
    int w,type;
    FREP(n){
        si(type);si(w);
        in[type] = i;
        if(w == 0){
            z[type].pb(i);
            continue;
        }
        if(type == 0)
            zero.insert(T(w,i));
        else
            one.pb(T(w,i));
    }
    sort(one.begin(), one.end());
    FREP(one.size()){
        handle(one[i].w, one[i].in);
    }
    handlezero();
    FREP(ans.size()){
        pis(ans[i].u+1);pis(ans[i].v+1);pi(ans[i].w);
    }
    return 0;
}
void handlezero(){
        FREP(z[1].size()){
            ans.pb(data(in[0], z[1][i], 0));
        }
        FREP(z[0].size()){
            ans.pb(data(in[1], z[0][i], 0));
        }
}
set<T> pi;
void handle(int we, int I){
    set<T>:: iterator it;
    for(it = zero.begin(); it!= zero.end(); it++){
        int mini = min(we, it->w);
        ans.pb(data(I, it->in, mini));
        we -= mini;
        if(it->w - mini!=0){
            int a = it->w-mini, b = it->in;
            pi.insert(T(a, b));
        }
        zero.erase(it);
        if(we == 0) break;
    }
    for(it = pi.begin(); it!= pi.end();it++){
        zero.insert(T(it->w, it->in));
    }
    pi.clear();
}


/*
Ashutosh Singla <ashu1461@gmail.com>
Algorithm:
#tags:
date: Sat Dec 14 00:34:48 IST 2013
*/

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<algorithm>
#include<climits>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long LL;
#define FL(a) memset(a, 0, sizeof a);
#define fill(a,v,N) memset(a, v, sizeof(a[0])*N)
#define sz(a) int((a).size())
#define pb push_back
#define si(n) scanf("%d",&n)
#define sin(n) scanf("%d\n",&n) // for scanning strings ..
#define sill(n) scanf("%lld",&n)
#define pi(n) printf("%d\n",n);
#define pill(n) printf("%lld\n",n);
#define pis(n) printf("%d ",n);

#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())  // map and set find ..
#define cpresent(c,x) (find(all(c),x) != (c).end())  // stl find ..
#define FREP(b) for(int i=0;i<b;i++)
#define FREPr(b) for(int i=b-1;i>=0;i--)
#define REP(a,b,c) for(int a=b;a<c;a++)
#define REPr(a,b,c) for(int a=b;a>b;a--)
#define mp(a,b) make_pair(a,b);
typedef pair<int, int> ii;
#define MAX_S 100007

struct data{
    int u,v,w;
    data(int U, int V, int W): w(W), u(U), v(V) {}
    data(){}
};
vector<data> ans;
struct T{
    int w, in;
    T(int W, int i) : w(W), in(i) {}
    T() {}
};
bool operator < (const T &a1, const T &a2){
    if(a1.w == a2.w) return a1.in < a2.in;
    return (a1.w < a2.w) ;

}
vector<T> one;
set<T> zero;
vector<int> z[2];
void handle(int, int);
void handlezero();
int in[2];
int in1[2];
int main()
{
    int n;
    si(n);
    int w,type;
    int zz;
    FREP(n){
        si(type);si(w);
        in[type] = i;
        if(w == 0){
            z[type].pb(i);
            continue;
        }
        if(type == 0){
            zero.insert(T(w,i));
            zz = i;
        }
        else
            one.pb(T(w,i));
    }
    if(one.size() > 0){
        in[1] = one[0].in;
    }
    if(zero.size() > 0){
        in[1] = zz;
    }
    sort(one.begin(), one.end());
    FREP(one.size()){
        handle(one[i].w, one[i].in);
    }
    handlezero();
    FREP(ans.size()){
        pis(ans[i].u+1);pis(ans[i].v+1);pi(ans[i].w);
    }
    return 0;
}
#define rock(a,b) (a>b)?ii(a,b):ii(b,a)
void handlezero(){
    int mini = min(z[0].size(), z[1].size());
    set<ii> S;
    FREP(z[1].size()){
        S.insert(rock(z[1][i], in[0]));
    }
    FREP(z[0].size()){
        S.insert(rock(z[0][i], in[1]));
    }
    for(set<ii>::iterator it = S.begin(); it!=S.end();it++){
        ans.pb(data(it->first, it->second, 0));
    }
    return;
}
set<T> pi;
void handle(int we, int I){
    set<T>:: iterator it = zero.begin(), it2;
    while(it!=zero.end()){
        int mini = min(we, it->w);
        ans.pb(data(I, it->in, mini));
        we -= mini;
        if(it->w - mini!=0){
            int a = it->w-mini, b = it->in;
            pi.insert(T(a, b));
        }
        it2 = it;
        it++;
        zero.erase(it2);
        if(we == 0) break;
    }
    for(it = pi.begin(); it!= pi.end();it++){
        zero.insert(T(it->w, it->in));
    }
    pi.clear();
    return ;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <stdio.h>

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;

#define newl "\n"
#define cnewl cout << newl
#define sci(x) static_cast<int>(x);

#define llu unsigned long long
#define lld long long

/* C

%d   - int
%lf  - double
%llu - unsigned long long
%c   - char
%s   - string / char table

*/
#define FO(i,n)       for (llu i = 0; i < n; ++i)
#define FOR(i,k,n)    for (auto i = k; i <= n; ++i)
#define FORR(i,k,n)   for (auto i = k; i >= n; --i)
#define FORds(it, ds) for (auto const& it : ds)
#define traversal(ds) for (auto const& it : ds) printf("%d ", it);

#define deb(x) cout << #x << " = " << x << newl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << newl

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007 // modulo 10e9 + 7
#define ConvertMicrosecondsToSeconds(duration) duration / 1e+6

typedef pair<int, int>  pii;
typedef pair<llu, llu>   pl;
typedef vector<int>      vi;
typedef vector<llu>      vl;
typedef vector<pii>    vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;

template<typename T> void si(T &x)
{
	x = 0;
	bool neg = 0;
	register T c = getchar();

	if (c == ' - ')
		neg = 1, c = getchar();

	while ((c < 48) || (c > 57))
		c = getchar();

	for ( ; c < 48 || c > 57 ; c = getchar());

	for ( ; c > 47 && c < 58; c = getchar() )
		x = (x << 3) + ( x << 1 ) + ( c & 15 );

	if (neg) x *= -1;
}

/*======= User-defined Function ======*/

/*====================================*/

void solve() {

	int n; si(n); // pobierz wartosc

	// stworz licznik wystepowan liczb parzystych (eve) oraz nieparzystych (odd) a takze zmienne, ktore beda przechowywać ich indexy (z dopiska id)
	int eve{}, eve_id{};
	int odd{}, odd_id{};

	vector<int> v(n); // stworz tablice (wektor) o rozmiarze n
	FO(i, n) { // petla wczytujaca wartosci tablicy
		si(v[i]); // pobierz wartosc tablicy o indexie 'i'

		if (v[i] % 2 == 0) { // jezeli liczba jest podzielna przez 2
			++eve; // zwieksz ilosc powtorzen liczb parzystych o jeden
			if (eve == 1) eve_id = i + 1; // jezeli napotkalismy po raz pierwszy liczbe parzysta to zapisz jej index jako i+1
		}
		else { // w przeciwnym wypadku to samo tylko ze dla liczb nieparzystych
			++odd;
			if (odd == 1) odd_id = i + 1;
		}
	}
	// wyswietl liczbe, ale najpierw sprawdz, ktora z nich jest "inna" tzn, wystapila tylko raz (nieparzysta czy parzysta), a nastepnie wyswietl odpowidni index
	printf("%d ", (odd == 1 ? odd_id : eve_id));

}

/*====================================*/

int32_t main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	auto t1 = std::chrono::high_resolution_clock::now();

	int t = 1;
	//sfi(t);
	while (t--) {
		solve();
	}

	auto t2 = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();

	cerr << newl << newl << "Duration of the algo: " << ConvertMicrosecondsToSeconds(duration) << " secs" << newl << newl;
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <stdio.h>

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;

#define newl "\n"
#define cnewl cout << newl
#define sci(x) static_cast<int>(x);

#define llu unsigned long long
#define lld long long

/* C

%d   - int
%lf  - double
%llu - unsigned long long
%c   - char
%s   - string / char table

*/
#define FO(i,n)       for (llu i = 0; i < n; ++i)
#define FOR(i,k,n)    for (auto i = k; i <= n; ++i)
#define FORR(i,k,n)   for (auto i = k; i >= n; --i)
#define FORds(it, ds) for (auto const& it : ds)
#define traversal(ds) for (auto const& it : ds) printf("%d ", it);

#define deb(x) cout << #x << " = " << x << newl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << newl

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007 // modulo 10e9 + 7
#define ConvertMicrosecondsToSeconds(duration) duration / 1e+6

typedef pair<int, int>  pii;
typedef pair<llu, llu>   pl;
typedef vector<int>      vi;
typedef vector<llu>      vl;
typedef vector<pii>    vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;

template<typename T> void si(T &x)
{
	x = 0;
	bool neg = 0;
	register T c = getchar();

	if (c == ' - ')
		neg = 1, c = getchar();

	while ((c < 48) || (c > 57))
		c = getchar();

	for ( ; c < 48 || c > 57 ; c = getchar());

	for ( ; c > 47 && c < 58; c = getchar() )
		x = (x << 3) + ( x << 1 ) + ( c & 15 );

	if (neg) x *= -1;
}

/*======= User-defined Function ======*/

/*====================================*/

void solve() {

	int n; si(n); // pobierz wartosc

	// stworz licznik wystepowan liczb parzystych (eve) oraz nieparzystych (odd) a takze zmienne, ktore beda przechowywać ich indexy (z dopiska id)
	int eve{}, eve_id{};
	int odd{}, odd_id{};

	vector<int> v(n); // stworz tablice (wektor) o rozmiarze n
	FO(i, n) { // petla wczytujaca wartosci tablicy
		si(v[i]); // pobierz wartosc tablicy o indexie 'i'

		if (v[i] % 2 == 0) { // jezeli liczba jest podzielna przez 2
			++eve; // zwieksz ilosc powtorzen liczb parzystych o jeden
			if (eve == 1) eve_id = i + 1; // jezeli napotkalismy po raz pierwszy liczbe parzysta to zapisz jej index jako i+1
		}
		else { // w przeciwnym wypadku to samo tylko ze dla liczb nieparzystych
			++odd;
			if (odd == 1) odd_id = i + 1;
		}
	}
	// wyswietl liczbe, ale najpierw sprawdz, ktora z nich jest "inna" tzn, wystapila tylko raz (nieparzysta czy parzysta), a nastepnie wyswietl odpowidni index
	printf("%d ", (odd == 1 ? odd_id : eve_id));

}

/*===============xd=====================*/

int32_t main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	auto t1 = std::chrono::high_resolution_clock::now();

	int t = 1;
	//sfi(t);
	while (t--) {
		solve();
	}

	auto t2 = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();

	cerr << newl << newl << "Duration of the algo: " << ConvertMicrosecondsToSeconds(duration) << " secs" << newl << newl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    long int n,a[100],i,x,y,o,e;
    while(cin>>n)
    {
        o=0,e=0;
        for(i=1; i<=n; i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
                {
                    e++;x=i;
                }
            else
                {
                    o++;y=i;
                }
        }
        if(o>e)
          cout<<x<<endl;
        else
            cout<<y<<endl;

}
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll               long long
#define nl               '\n'                             // NL - sign of new line

#define upc(str, c)      str[c] = toupper(str[c]);         // make single char uppercase
#define lowerc(str, c)   str[c] = tolower(str[c]);         // make single char lowercase

#define ups(str)       	 transform(str.begin(), str.end(), str.begin(), ::toupper); // make entire string uppercase
#define lowers(str)      transform(str.begin(), str.end(), str.begin(), ::tolower); // make entire string lowercase

#define ps(x,y)          fixed << setprecision(y) << x     // usage: t=1.1234; cout << ps(t,4); // it means it will print 4 decimal places.

#define vi               vector <int>                      //create vector of int numbers
#define vs               vector <string>                      //create vector of int numbers
#define eb               emplace_back
#define rev(v)		     reverse(v.begin(), v.end())       // reverse the vector

#define mii			     map <int,int>
#define mss			     map <string, string>

#define w(t)             unsigned int t; cin >> t; while(t--)      //  usage: create quickly number of test
mt19937                  rng(chrono::steady_clock::now().time_since_epoch().count());

void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
//==================================

struct S {
	int val;
	friend bool operator > (const S& lhs, const S& rhs) {
		return lhs.val > rhs.val;
	}
};

//==================================
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	c_p_c();
	//--------------------------------

	int i{1};
	int odd{}, eve{};
	int c_o{}, c_e{};

	w(t)
	{
		int e; cin >> e;
		if (e % 2 == 0)
		{
			if (eve == 0) eve = i;
			c_e++;
		}
		else
		{
			if (odd == 0) odd = i;
			c_o++;
		}
		++i;
	}

	if (c_o > c_e) cout << eve;
	else cout << odd;

	return 0;

}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <stdio.h>

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;

#define newl "\n"
#define cnewl cout << newl
#define sci(x) static_cast<int>(x);

#define llu unsigned long long
#define lld long long

/* C

%d   - int
%lf  - double
%llu - unsigned long long
%c   - char
%s   - string / char table

*/
#define FO(i,n)       for (llu i = 0; i < n; ++i)
#define FOR(i,k,n)    for (auto i = k; i <= n; ++i)
#define FORR(i,k,n)   for (auto i = k; i >= n; --i)
#define FORds(it, ds) for (auto const& it : ds)
#define traversal(ds) for (auto const& it : ds) printf("%d ", it);

#define deb(x) cout << #x << " = " << x << newl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << newl

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007 // modulo 10e9 + 7
#define ConvertMicrosecondsToSeconds(duration) duration / 1e+6

typedef pair<int, int>  pii;
typedef pair<llu, llu>   pl;
typedef vector<int>      vi;
typedef vector<llu>      vl;
typedef vector<pii>    vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;

/*======= User-defined Function ======*/

/*====================================*/

void solve() {

	int n; scanf("%d", &n); // pobierz wartosc

	// stworz licznik wystepowan liczb parzystych (eve) oraz nieparzystych (odd) a takze zmienne, ktore beda przechowywać ich indexy (z dopiska id)
	int eve{}, eve_id{};
	int odd{}, odd_id{};

	vector<int> v(n); // stworz tablice (wektor) o rozmiarze n
	FO(i, n) { // petla wczytujaca wartosci tablicy
		scanf(" %d", &v[i]); // pobierz wartosc tablicy o indexie 'i'

		if (v[i] % 2 == 0) { // jezeli liczba jest podzielna przez 2
			++eve; // zwieksz ilosc powtorzen liczb parzystych o jeden
			if (eve == 1) eve_id = i + 1; // jezeli napotkalismy po raz pierwszy liczbe parzysta to zapisz jej index jako i+1
		}
		else { // w przeciwnym wypadku to samo tylko ze dla liczb nieparzystych
			++odd;
			if (odd == 1) odd_id = i + 1;
		}
	}
	// wyswietl liczbe, ale najpierw sprawdz, ktora z nich jest "inna" tzn, wystapila tylko raz (nieparzysta czy parzysta), a nastepnie wyswietl odpowidni index
	printf("%d ", (odd == 1 ? odd_id : eve_id));

}

/*====================================*/

int32_t main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	auto t1 = std::chrono::high_resolution_clock::now();

	int t = 1;
	//sfi(t);
	while (t--) {
		solve();
	}

	auto t2 = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();

	cerr << newl << newl << "Duration of the algo: " << ConvertMicrosecondsToSeconds(duration) << " secs" << newl << newl;
	return 0;
}


#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <stdio.h>

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;

#define newl "\n"
#define cnewl cout << newl
#define sci(x) static_cast<int>(x);

#define llu unsigned long long
#define lld long long

/* C

%d   - int
%lf  - double
%llu - unsigned long long
%c   - char
%s   - string / char table

*/
#define FO(i,n)       for (llu i = 0; i < n; ++i)
#define FOR(i,k,n)    for (auto i = k; i <= n; ++i)
#define FORR(i,k,n)   for (auto i = k; i >= n; --i)
#define FORds(it, ds) for (auto const& it : ds)
#define traversal(ds) for (auto const& it : ds) printf("%d ", it);

#define deb(x) cout << #x << " = " << x << newl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << newl

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007 // modulo 10e9 + 7
#define ConvertMicrosecondsToSeconds(duration) duration / 1e+6

typedef pair<int, int>  pii;
typedef pair<llu, llu>   pl;
typedef vector<int>      vi;
typedef vector<llu>      vl;
typedef vector<pii>    vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;

/*======= User-defined Function ======*/

/*====================================*/

void solve() {

	int n; scanf("%d", &n); // pobierz wartosc

	// stworz licznik wystepowan liczb parzystych (eve) oraz nieparzystych (odd) a takze zmienne, ktore beda przechowywać ich indexy (z dopiska id)
	int eve = 0, eve_id = 0, odd = 0, odd_id = 0;

	vector<int> v(n); // stworz tablice (wektor) o rozmiarze n
	FO(i, n) { // petla wczytujaca wartosci tablicy
		scanf(" %d", &v[i]); // pobierz wartosc tablicy o indexie 'i'

		if (v[i] % 2 == 0) { // jezeli liczba jest podzielna przez 2
			++eve; // zwieksz ilosc powtorzen liczb parzystych o jeden
			if (eve == 1) eve_id = i + 1; // jezeli napotkalismy po raz pierwszy liczbe parzysta to zapisz jej index jako i+1
		}
		else { // w przeciwnym wypadku to samo tylko ze dla liczb nieparzystych
			++odd;
			if (odd == 1) odd_id = i + 1;
		}
	}
	// wyswietl liczbe, ale najpierw sprawdz, ktora z nich jest "inna" tzn, wystapila tylko raz (nieparzysta czy parzysta), a nastepnie wyswietl odpowidni index
	printf("%d ", (odd == 1 ? odd_id : eve_id));

}

/*====================================*/

int32_t main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	auto t1 = std::chrono::high_resolution_clock::now();

	int t = 1;
	//sfi(t);
	while (t--) {
		solve();
	}

	auto t2 = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();

	cerr << newl << newl << "Duration of the algo: " << ConvertMicrosecondsToSeconds(duration) << " secs" << newl << newl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;int ar[n];for(int i=0;i<n;i++){
        cin>>ar[i];
    }int a[n],b[n],q=0,w=0;
    for(int i=0,j=0;i<n;i++){if(ar[i]%2==0){q++;a[j]=i;j++;}
    if(ar[i]%2!=0){w++;b[j]=i;j++;}

        if(q>1)cout<<b[0];
        else cout<<a[0];
    }


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,j=0,i=0,z=0;cin>>n;int ar[n];for(int i=0;i<n;i++){
        cin>>ar[i];}
        int a[n],b[n],q=0,w=0;
    for(;i<n;i++){if(ar[i]%2==0){q++;a[z]=i;z++;}
    if(ar[i]%2!=0){w++;b[j]=i;j++;}
}
        if(q>1)cout<<b[0];
        else cout<<a[0];
    }


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,j=0,i=0;cin>>n;int ar[n];for(int i=0;i<n;i++){
        cin>>ar[i];
    }int a[n],b[n],q=0,w=0;
    for(;i<n;i++){if(ar[i]%2==0){q++;a[j]=i;j++;}}
    if(ar[i]%2!=0){w++;b[j]=i;j++;}

        if(q>1)cout<<b[0];
        else cout<<a[0];
    }


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,j=0;cin>>n;int ar[n];for(int i=0;i<n;i++){
        cin>>ar[i];
    }int a[n],b[n],q=0,w=0;
    for(int i=0;i<n;i++){if(ar[i]%2==0){q++;a[j]=i;j++;}}
    if(ar[i]%2!=0){w++;b[j]=i;j++;}

        if(q>1)cout<<b[0];
        else cout<<a[0];
    }


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;int ar[n];for(int i=0;i<n;i++){
        cin>>ar[i];
    }int a[n],b[n],q=0,w=0;
    for(int i=0,j=0;i<n;i++){if(ar[i]%2==0){q++;a[j]=i;j++;}}
    if(ar[i]%2!=0){w++;b[j]=i;j++;}

        if(q>1)cout<<b[0];
        else cout<<a[0];
    }


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,j=0,i=0,z=0;cin>>n;int ar[n];for(int i=0;i<n;i++){
        cin>>ar[i];
    }int a[n],b[n],q=0,w=0;
    for(;i<n;i++){if(ar[i]%2==0){q++;a[z]=i;z++;}}
    if(ar[i]%2!=0){w++;b[j]=i;j++;}

        if(q>1)cout<<b[0];
        else cout<<a[0];
    }


#include<iostream>
#include<vector>
using namespace std;
int main()
{vector<int> a;
vector<int> even;
vector<int> odd;
int i,b,n,l,l1;
cin >> n;
for(i=0;i<n;i++)
{while(cin >> b)
a.push_back(b);
}
for(i=0;i<n;i++)
{if(a[i]%2==0)
even.push_back(i+1);
else
odd.push_back(i+1);
}
l=odd.size();
l1=even.size();
if(l>l1)
cout << even[0];
else
cout << odd[0];
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{int n,i;
vector<int> v;
int a;
for(i=0;i<n;i++)
{while(cin >> a)
v.push_back(a);
}
sort(v.begin(),v.end());
if(a[0]%2==0)
{for(i=0;i<n;i++)
if(a[i]%2!=0);
cout << i+1;
}

if(a[0]%2!=0)
{for(i=0;i<n;i++)
if(a[i]%2=0);
cout << i+1;
}

}


#include<iostream>
using namespace std;
int main()
{int n;
cin >> n;
int a[n];
int b[n],c[n];
int i,j;
for(i=0;i<n;i++)
{cin >> a[i];
}
for(j=0;j<n;j++)
{if(a[i]%2==0)
b[i]=i+1;
else
c[i]=i+1;
cout << c[i];
}
for(j=0;j<n;j++)
{if(a[i]%2!=0)
b[i]=i+1;
else
c[i]=i+1;
cout << c[i];
}
}


#include<iostream>
using namespace std;
int main()
{int n;
cin >> n;
int a[n];
int b[n],c[n];
int i,j;
for(i=0;i<n;i++)
{cin >> a[i];
}

for(j=0;j<n;j++)
{if(a[i]%2==0)
b[i]=i+1;
else
c[i]=i+1;
cout << c[i];
}
for(j=0;j<n;j++)
{if(a[i]%2!=0)
b[i]=i+1;
else
c[i]=i+1;
cout << c[i];
}
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{vector<int> a;
vector<int> even;
vector<int> odd;
int i,b,n,l,l1;
for(i=0;i<n;i++)
{while(cin >> b)
a.push_back(b);
}
for(i=0;i<n;i++)
{if(a[i]%2==0)
even.push_back(i+1);
else
odd.push_back(i+1);
}
l=odd.size();
l1=even.size();
if(l>l1)
cout << even[0];
else
cout << odd[0];
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{vector<int> a;
vector<int> even;
vector<int> odd;
int i,b,n,l,l1;
cin >> n;
for(i=0;i<n;i++)
{while(cin >> b)
a.push_back(b);
}
for(i=0;i<a.size();i++)
{if(a[i]%2==0)
even.push_back(i+1);
else
odd.push_back(i+1);
}
l=odd.size();
l1=even.size();
if(l>l1)
cout << even[0];
else
cout << odd[0];
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{vector<int> a;
vector<int> even;
vector<int> odd;
int i,b,n,l,l1;
for(i=0;i<n;i++)
{while(cin >> b)
a.push_back(b);
}
for(i=0;i<a.size();i++)
{if(a[i]%2==0)
even.push_back(i+1);
else
odd.push_back(i+1);
}
l=odd.size();
l1=even.size();
if(l>l1)
cout << even[0];
else
cout << odd[0];
}


#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{int n,i;
vector<int> v;
int a;
for(i=0;i<n;i++)
{while(cin >> a)
v.push_back(a);
}
sort(v.begin(),v.end());
if(v[0]%2==0)
{for(i=0;i<n;i++)
if(v[i]%2!=0);
cout << i+1;
}

if(v[0]%2!=0)
{for(i=0;i<n;i++)
if(v[i]%2==0);
cout << i+1;
}

}


#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{int n,i;
vector<int> v;
int a;
for(i=0;i<n;i++)
{while(cin >> a)
v.push_back(a);
}
sort(v.begin(),v.end());
if(v[0]%2==0)
{for(i=0;i<n;i++)
if(v[i]%2!=0);
cout << i+1;
}

if(v[0]%2!=0)
{for(i=0;i<n;i++)
if(v[i]%2=0);
cout << i+1;
}

}


#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{int n,i;
vector<int> v;
int a;
for(i=0;i<n;i++)
{while(cin >> a)
v.push_back(a);
}
sort(v.begin(),v.end());
if(a[0]%2==0)
{for(i=0;i<n;i++)
if(a[i]%2!=0);
cout << i+1;
}

if(a[0]%2!=0)
{for(i=0;i<n;i++)
if(a[i]%2=0);
cout << i+1;
}

}


/**
Author: Md. Sakib Uddin.
Email: hi.sakib75@gmail.com
From: RMSTU
**/

#include<bits/stdc++.h>
using namespace std;
#define    F           first
#define    S           second
#define    pb          push_back
#define    popb        pop_back
#define    pf          push_front
#define    popf        pop_front
#define    lcm(a,b)    (a*b)/gcd(a,b)
#define    gcd(a,b)    __gcd(a,b)
#define    pi          2*acos(0)
#define    elif        else if
#define    ll          long long
#define    nl          '\n'
#define    endl        '\n'
#define    fori(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#define    for0(i,n)   for(int (i)=0; (i) < (n); (i)++)
#define    sp          fixed << setprecision
#define    vll         vector<ll>
#define    all(x)      x.begin(),x.end()
#define    reall(x)    x.rbegin(),x.rend()
#define    power(n,p)  pow_mod(n, p, (1LL<<62))

/** ===================== DEBUG  ==========================**/

#ifdef iSakiBee
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#define    debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define    in_file     freopen("input.c", "r", stdin)
#define    out_file    freopen("output.c", "w", stdout)
#define    fast        0
#else
#define    debug(...)  0
#define    in_file     0
#define    out_file    0
#define    fast        ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
/** ===================== custom function ==========================**/
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }

/** ===================== main function ============================**/

int main()
{
    ll n,x,p,cnt = 1;
    cin >> n;
    vll v,v2;
    for(ll i=0; i<n; i++){
        cin >> x;
        v.pb(x);
    }for(ll i=0; i<n-1; i++){
        p = abs(v[i]-v[i+1]);
        v2.pb(p);
    }
    sort(all(v2));
    for(ll i=0; i<v2.size()-1; i++)
    {
        if(v2[i] != v2[i+1]) cnt++;
    }
    cout << cnt << endl;
}


/**
Author: Md. Sakib Uddin.
Email: hi.sakib75@gmail.com
From: RMSTU
**/

#include<bits/stdc++.h>
using namespace std;
#define    F           first
#define    S           second
#define    pb          push_back
#define    popb        pop_back
#define    pf          push_front
#define    popf        pop_front
#define    lcm(a,b)    (a*b)/gcd(a,b)
#define    gcd(a,b)    __gcd(a,b)
#define    pi          2*acos(0)
#define    elif        else if
#define    ll          long long
#define    nl          '\n'
#define    endl        '\n'
#define    fori(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#define    for0(i,n)   for(int (i)=0; (i) < (n); (i)++)
#define    sp          fixed << setprecision
#define    vll         vector<ll>
#define    all(x)      x.begin(),x.end()
#define    reall(x)    x.rbegin(),x.rend()
#define    power(n,p)  pow_mod(n, p, (1LL<<62))

/** ===================== DEBUG  ==========================**/

#ifdef iSakiBee
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#define    debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define    in_file     freopen("input.c", "r", stdin)
#define    out_file    freopen("output.c", "w", stdout)
#define    fast        0
#else
#define    debug(...)  0
#define    in_file     0
#define    out_file    0
#define    fast        ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
/** ===================== custom function ==========================**/
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }

/** ===================== main function ============================**/

int main()
{
    ll n,x,p,cnt = 1;
    cin >> n;
    vll ov,v,v2;
    ll cod = 0, cev = 0;
    for(ll i=0; i<n; i++){
        cin >> x;
        ov.pb(x);
        if(x&1) {cod++; v.pb(x);} else {cev++; v2.pb(x);};
    }
    if(cod > cev)
    {
        for(ll i=0; i<n; i++)
        if(v2[cev-1] == ov[i]){
            cout << i+1 << endl;
            break;
        }
    }
    else{
        for(ll i=0; i<n; i++)
        if(v[cod-1] == ov[i]){
            cout << i+1 << endl;
            break;
        }
    }

}


/**
Author: Md. Sakib Uddin.
Email: hi.sakib75@gmail.com
From: RMSTU
**/

#include<bits/stdc++.h>
using namespace std;
#define    F           first
#define    S           second
#define    pb          push_back
#define    popb        pop_back
#define    pf          push_front
#define    popf        pop_front
#define    lcm(a,b)    (a*b)/gcd(a,b)
#define    gcd(a,b)    __gcd(a,b)
#define    pi          2*acos(0)
#define    elif        else if
#define    ll          long long
#define    nl          '\n'
#define    endl        '\n'
#define    fori(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#define    for0(i,n)   for(int (i)=0; (i) < (n); (i)++)
#define    sp          fixed << setprecision
#define    vll         vector<ll>
#define    all(x)      x.begin(),x.end()
#define    reall(x)    x.rbegin(),x.rend()
#define    power(n,p)  pow_mod(n, p, (1LL<<62))

/** ===================== DEBUG  ==========================**/

#ifdef iSakiBee
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#define    debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define    in_file     freopen("input.c", "r", stdin)
#define    out_file    freopen("output.c", "w", stdout)
#define    fast        0
#else
#define    debug(...)  0
#define    in_file     0
#define    out_file    0
#define    fast        ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
/** ===================== custom function ==========================**/
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }

/** ===================== main function ============================**/

int main()
{
    ll n,x,p,cnt = 1;
    cin >> n;
    vll v,v2;
    for(ll i=0; i<n; i++){
        cin >> x;
        x&1 ? v.pb(x) : v2.pb(x);
    }
    ll od = v.size();
    ll ev = v2.size();
    od>ev ? cout << v2[ev-1] << endl : cout << v[od-1] << endl;

}


/**
Author: Md. Sakib Uddin.
Email: hi.sakib75@gmail.com
From: RMSTU
**/

#include<bits/stdc++.h>
using namespace std;
#define    F           first
#define    S           second
#define    pb          push_back
#define    popb        pop_back
#define    pf          push_front
#define    popf        pop_front
#define    lcm(a,b)    (a*b)/gcd(a,b)
#define    gcd(a,b)    __gcd(a,b)
#define    pi          2*acos(0)
#define    elif        else if
#define    ll          long long
#define    nl          '\n'
#define    endl        '\n'
#define    fori(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#define    for0(i,n)   for(int (i)=0; (i) < (n); (i)++)
#define    sp          fixed << setprecision
#define    vll         vector<ll>
#define    all(x)      x.begin(),x.end()
#define    reall(x)    x.rbegin(),x.rend()
#define    power(n,p)  pow_mod(n, p, (1LL<<62))

/** ===================== DEBUG  ==========================**/

#ifdef iSakiBee
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#define    debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define    in_file     freopen("input.c", "r", stdin)
#define    out_file    freopen("output.c", "w", stdout)
#define    fast        0
#else
#define    debug(...)  0
#define    in_file     0
#define    out_file    0
#define    fast        ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
/** ===================== custom function ==========================**/
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }

/** ===================== main function ============================**/

int main()
{
    ll n,x;
    cin >> n;
    ll cod = 0, cev = 0;
    ll op,ep;
    for(ll i=0; i<n; i++){
        cin >> x;
        if(x&1) {cod++; op= i+1;} else {cev++; ep = i+1;};
    }
    cod == 1 ? cout << op << endl : cout << ep << endl;
}


/**
Author: Md. Sakib Uddin.
Email: hi.sakib75@gmail.com
From: RMSTU
**/

#include<bits/stdc++.h>
using namespace std;
#define    F           first
#define    S           second
#define    pb          push_back
#define    popb        pop_back
#define    pf          push_front
#define    popf        pop_front
#define    lcm(a,b)    (a*b)/gcd(a,b)
#define    gcd(a,b)    __gcd(a,b)
#define    pi          2*acos(0)
#define    elif        else if
#define    ll          long long
#define    nl          '\n'
#define    endl        '\n'
#define    fori(i,b,e) for(int (i)=(b); (i) <= (e); (i)++)
#define    for0(i,n)   for(int (i)=0; (i) < (n); (i)++)
#define    sp          fixed << setprecision
#define    vll         vector<ll>
#define    all(x)      x.begin(),x.end()
#define    reall(x)    x.rbegin(),x.rend()
#define    power(n,p)  pow_mod(n, p, (1LL<<62))

/** ===================== DEBUG  ==========================**/

#ifdef iSakiBee
vector<string>vec_spltr(string s){s+=',';vector<string>res;while(!s.empty())
res.push_back(s.substr(0, s.find(','))),s=s.substr(s.find(',')+1);return res;}
void dbg_out(vector<string>__attribute__((unused))args,__attribute__((unused))int idx,
__attribute__((unused))int LINE_NUM){cerr<<endl;}template<typename Head,typename... Tail>
void dbg_out ( vector <string> args, int idx, int LINE_NUM, Head H, Tail... T)
{if(idx>0)cerr<<", ";else cerr << "Line(" << LINE_NUM << ") ";stringstream ss;ss<<H;
cerr<<args[idx]<<" = "<<ss.str();dbg_out(args,idx+1,LINE_NUM, T...);}
#define    debug(...) dbg_out(vec_spltr(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#define    in_file     freopen("input.c", "r", stdin)
#define    out_file    freopen("output.c", "w", stdout)
#define    fast        0
#else
#define    debug(...)  0
#define    in_file     0
#define    out_file    0
#define    fast        ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#endif
/** ===================== custom function ==========================**/
ll pow_mod(ll nn, ll pp, ll mm) { ll res = 1; while(pp > 0) { if(pp&1) res = (res * nn) % mm; pp = pp >> 1; nn = (nn * nn) % mm; } return res; }

/** ===================== main function ============================**/

int main()
{
    ll n,x,p,cnt = 1;
    cin >> n;
    vll v,v2;
    for(ll i=0; i<n; i++){
        cin >> x;
        v.pb(x);
    }
    for(ll i=0; i<n-1; i++){
        p = v[i+1]-v[i];
        if(p!=0) v2.pb(p);
    }
    sort(all(v2));
    for(ll i=0; i<v2.size()-1; i++)
    {
        if(v2[i] != v2[i+1]) cnt++;
    }
    cout << cnt << endl;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n; cin>>n;
  int a[n];
  int o=0, e=0;
  for(int i=0; i<n; ++i) {
    int v; cin>>v;
    if(v&1) o++, a[i]=1;
    else e++, a[i]=0;
  }
  if(o>e)
    for(int i=0; i<n; ++i) {
      if(a[i] == 0)
        cout<<i+1; break;
    }
  else
    for(int i=0; i<n; ++i) {
      if(a[i] == 1)
        cout<<i+1; break;
    }
  return 0;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n;
  vector<int> e,o;
  for(int i=1; n--; ++i) {
    int num;
    if(n&1) o.pb(i);
    else e.pb(i);
  }
  if(o.size()==1) cout<<o[0];
  else cout<<e[0];
  return 0;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n; cin>>n;
  int a[n];
  int o=0, e=0;
  for(int i=0; i<n; ++i) {
    int v; cin>>v;
    if(v&1) o++, a[i]=1;
    else e++, a[i]=0;
  }
  if(o>e)
    for(int i=0; i<n; ++i) {
      if(a[i] == 0)
        cout<<i+1<<break;
    }
  else
    for(int i=0; i<n; ++i) {
      if(a[i] == 1)
        cout<<i+1<<break;
    }
  return 0;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n; cin>>n;
  vector<int> e,o;
  for(int i=1; n--; ++i) {
    int num; cin>>num;
    if(num&1) o.pb(i);
    else e.pb(i);
  }
  if(o.size()==1) cout<<o[0];
  else cout<<e[0];
  return 0;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n; cin>>n;
  for(int i=0, no=0, ne=0; i<n; ++i) {
    int v; cin>>v;
    if(v&1) no++;
    else ne++;
    if(no>1 && ne==1) {
      cout<<i+1; break;
    } else if(ne>1 && no==1) {
      cout<<i+1; break;
    }
  }
  return 0;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n; cin>>n;
  for(int i=0, no=0, ne=0; i<n; ++i) {
    if(n&1) no++;
    else ne++;
    if(no>1 && ne==1) {
      cout<<i+1; break;
    } else if(ne>1 && no==1) {
      cout<<i+1; break;
    }
  }
  return 0;
}


#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define fi first
#define se second;
#define mp make_pair
typedef long long ll;
using namespace std;

int main() {
  FAST_IO;
  int n; cin>>n;
  int a[n];
  int o=0, e=0;
  for(int i=0; i<n; ++i) {
    int v; cin>>v;
    if(v&1) o++, a[i]=1;
    else e++, a[i]=0;
  }

  if(o>e)
    for(int i=0; i<n; ++i) {
      if(a[i] == 0)
        {cout<<i+1; break;}
    }
  else
    for(int i=0; i<n; ++i) {
      if(a[i] == 1)
        {cout<<i+1; break;}
    }

  return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n, b;
	cin >> n;
	int even = 0, odd = 0, e, o;
	for (int i = 0; i < n; i++) {
		cin >> b;
		if (b % 2 == 0) {
			even++;
			e = i;
		}
		else {
			odd++;
			o = i;
		}

	}
	o++;
	e++;
	if (even > odd)cout << o;
	else cout << e;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const long long N=1e6;
int d(){
    int ret;
    scanf("%d",&ret);
    return ret;
}
long long lld(){
    long long ret;
    scanf("%lld",&ret);
    return ret;
}
bool cmp(int s,int f){
    if(s>f)
        return true;

    return false;
}
int arr[N];
int main(){
    int n=d();
    scanf("%d",arr+0);
    for(int i=1;i<n;i++){
        scanf("%d",arr+i);
        int mx=max(arr[i],arr[i-1]);
        int mn=min(arr[i],arr[i-1]);
        if(mx%mn!=0){

            printf("%d\n",i+1);
            return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
const long long N=1e6;
int d(){
    int ret;
    scanf("%d",&ret);
    return ret;
}
long long lld(){
    long long ret;
    scanf("%lld",&ret);
    return ret;
}
bool cmp(int s,int f){
    if(s>f)
        return true;

    return false;
}
int arr[N];
int main(){
    int n=d();
    scanf("%d",arr+0);
    for(int i=1;i<n;i++){
        scanf("%d",arr+i);
        int mx=max(arr[i],arr[i-1]);
        int mn=min(arr[i],arr[i-1]);
        if(mx%mn!=0){

            printf("%d\n",i+1);
            return 0;
        }
    }
    for(int i=1;i<n;i++){
        if(arr[i]!=arr[i-1]){
            printf("%d\n",arr[i]);
            return 0;
        }
        }
}


#include<bits/stdc++.h>
using namespace std;
const long long N=1e6;
int d(){
    int ret;
    scanf("%d",&ret);
    return ret;
}
long long lld(){
    long long ret;
    scanf("%lld",&ret);
    return ret;
}
bool cmp(int s,int f){
    if(s>f)
        return true;

    return false;
}
int arr[N];
int main(){
    int n=d();

    int ans;
    scanf("%d",arr+0);

    for(int i=1;i<n;i++){
        scanf("%d",arr+i);

    }
    if(arr[1]%2==arr[0]%2){
        ans=arr[1]%2;
    }
    else{
        if(arr[0]%2==arr[2]%2){
            printf("2\n");
            return 0;
        }
        if(arr[1]%2==arr[2]%2){
            printf("1\n");
            return 0;
        }
        if(arr[0]%2==arr[1]%2){
            printf("3\n");
            return 0;
        }
    }
    if(ans==1){
        ans=0;
    }
    else
        ans=1;
    for(int i=0;i<n;i++){
        if(arr[i]%2==ans){
            printf("%d\n",i+1);
            return 0;
        }
    }

}


#include<bits/stdc++.h>
using namespace std;
const long long N=1e6;
int d(){
    int ret;
    scanf("%d",&ret);
    return ret;
}
long long lld(){
    long long ret;
    scanf("%lld",&ret);
    return ret;
}
bool cmp(int s,int f){
    if(s>f)
        return true;

    return false;
}
int arr[N];
int main(){
    int n=d();
    scanf("%d",arr+0);
    for(int i=1;i<n;i++){
        scanf("%d",arr+i);
        int mx=max(arr[i],arr[i-1]);
        int mn=min(arr[i],arr[i-1]);
        if(mx%mn!=0){

            printf("%d\n",i+1);
            return 0;
        }
    }
    for(int i=1;i<n;i++){
        if(arr[i]!=arr[i-1]){
            if(arr[i]!=arr[i+1] && arr[i]!=arr[i-1] ){
                printf("%d\n",n);
                return 0;
            }
            if(arr[i]!=arr[i+1]){
                printf("%d\n",arr[i]);
                return 0;
            }
            else{
                printf("%d\n",arr[i-1]);
                return 0;
            }
        }
        }
}


#include<bits/stdc++.h>
using namespace std;
const long long N=1e6;
int d(){
    int ret;
    scanf("%d",&ret);
    return ret;
}
long long lld(){
    long long ret;
    scanf("%lld",&ret);
    return ret;
}
bool cmp(int s,int f){
    if(s>f)
        return true;

    return false;
}
int arr[N];
int main(){
    int n=d();
    scanf("%d",arr+0);
    for(int i=1;i<n;i++){
        scanf("%d",arr+i);
        int mx=max(arr[i],arr[i-1]);
        int mn=min(arr[i],arr[i-1]);
        if(mx%mn!=0){

            printf("%d\n",i+1);
            return 0;
        }
    }
    for(int i=1;i<n;i++){
        if(arr[i]!=arr[i-1]){
            if(arr[i]!=arr[i+1] && arr[i]!=arr[i-1] && arr[i-1]!=arr[i+1]){
                printf("%d\n",n);
                return 0;
            }
            if(arr[i]!=arr[i+1]){
                printf("%d\n",arr[i]);
                return 0;
            }
            else{
                printf("%d\n",arr[i-1]);
                return 0;
            }
        }
        }
}


#include <bits/stdc++.h>
using namespace std;
int n,oddc, evenc,lastodd,lasteven ;
int main()
{
    cin>>n;
    int arr[n+1];
    for(int i = 1 ; i <=n; i++)
    {
        cin>>arr[i];
        if(arr[i]%2==0)
        {
            evenc++;
            lasteven=i;

        }
        else
        {
            oddc++;

            lastodd=i;
        }

    }
    if(evenc ==1)
    cout<<lasteven;
    else
    cout<<lastodd;

}


#include<bits/stdc++.h>
using namespace std;
const long long N=1e6;
int d(){
    int ret;
    scanf("%d",&ret);
    return ret;
}
long long lld(){
    long long ret;
    scanf("%lld",&ret);
    return ret;
}
bool cmp(int s,int f){
    if(s>f)
        return true;

    return false;
}
int arr[N];
int main(){
    int n=d();
    scanf("%d",arr+0);
    for(int i=1;i<n;i++){
        scanf("%d",arr+i);
        int mx=max(arr[i],arr[i-1]);
        int mn=min(arr[i],arr[i-1]);
        if(mx%mn!=0){

            printf("%d\n",i+1);
            return 0;
        }
    }
    for(int i=1;i<n;i++){
        if(arr[i]!=arr[i-1]){
            if(arr[i]!=arr[i+1]){
                printf("%d\n",arr[i]);
                return 0;
            }
            else{
                printf("%d\n",arr[i-1]);
                return 0;
            }
        }
        }
}


#include<iostream>
using namespace std;
int main()
{
    int n,arr[n],even=0,odd=0,j=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
    while(even<=1&&odd<=1)
    	{
        	if(arr[j]%2==0)
        	even++;
        	else
        	odd++;
        	j++;
    	}
    if(even>1)
    {
    	for(int k=0;k<n;k++)
    	if(arr[k]%2!=0)
    	cout<<k+1;
    }
    else
    {
    	for(int x=0;x<n;x++)
    	if(arr[x]%2==0)
    	cout<<x+1;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,arr[n],lasteven=0,lastodd=0,even=0,odd=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
    for(int j=0;j<n;j++)
       	{
        	if(arr[j]%2==0)
        	{
        	even++;
        	lasteven=j+1;
        	}
        	else
        	{
        	lastodd=j+1;
        	odd++;
        	}
    	}
    if(even>1)
    {
	cout<<lastodd;
    }
    else if(odd>1)
    {
    cout<<lasteven;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,arr[n],even=0,odd=0,j;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
     while(even<=1&&odd<=1)
    	{
        	if(arr[j]%2==0)
        	even++;
        	else
        	odd++;
        	j++;
    	}
    cout<<j;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,arr[n],lasteven=0,lastodd=0,even=0,odd=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
    for(int j=0;j<n;j++)
       	{
        	if(arr[j]%2==0)
        	{
        	even++;
        	lasteven=j+1;
        	}
        	else
        	{
        	lastodd=j +1;
        	odd++;
        	}
    	}
    if(even>1)
    {
	cout<<lastodd;
    }
    else if(odd>1)
    {
    cout<<lasteven;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,arr[n],even=0,odd=0,j=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
     while(even<=1&&odd<=1)
    	{
        	if(arr[j]%2==0)
        	even++;
        	else
        	odd++;
        	j++;
    	}
    cout<<j;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,arr[n],even=0,odd=0,j=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
    while(even<=1&&odd<=1)
    	{
        	if(arr[j]%2==0)
        	even++;
        	else
        	odd++;
        	    j++;
    	}
    if(even>1)
    {
    	for(int k=0;k<n;k++)
    	if(arr[k]%2!=0)
    	cout<<k+1;
    }
    else
    {
    	for(int x=0;x<n;x++)
    	if(arr[x]%2==0)
    	cout<<x+1;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n,lasteven=0,lastodd=0,even=0,odd=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    for(int j=0;j<n;j++)
       	{
        	if(arr[j]%2==0)
        	{
        	even++;
        	lasteven=j+1;
        	}
        	else
        	{
        	lastodd=j +1;
        	odd++;
        	}
    	}
    if(even>1)
    {
	cout<<lastodd;
    }
    else if(odd>1)
    {
    cout<<lasteven;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int n=0,arr[n],even=0,odd=0,j=0;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>arr[i];
    while(even<=1&&odd<=1)
    	{
        	if(arr[j]%2==0)
        	even++;
        	else
        	odd++;
        	j++;
    	}
    if(even>1)
    {
    	for(int k=0;k<n;k++)
    	if(arr[k]%2!=0)
    	cout<<k+1;
    }
    else
    {
    	for(int x=0;x<n;x++)
    	if(arr[x]%2==0)
    	cout<<x+1;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t,n;
  int a[100];
  cin>>n;
  for(int i=0;i<n;i++)
  {
  	cin>>a[i];
  }
  if(n==3)
  {
     for(int i=0;i<n;i++)
	 {
	 	if(a[i]!=a[i+1])
	 	{
	 		cout<<i+1;
		 }
	  }
  	return 0;
  }

  if(n%2==0)
  t=n/2;
  else
  t=n/2+1;
  cout<<t;

	return 0;
}


#include<bits\stdc++.h>
using namespace std;
int main()
{
	int t=0,k=0,m,n,a[1000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]%2==0)
		k++;
		else
		t++;
	}
	m=abs(k-t);
	cout<<m;
	return 0;
}


#include<bits\stdc++.h>
using namespace std;
int main()
{
	int t=0,k=0,j=0,n,a[1000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]%2==0)
		{
				k++;
				n=i;
		}

		else
		{
			j=i;
		t++;
	}
	}
  if(k==1)
  cout<<1+n;
  if(t==1)
  cout<<1+j;

	return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t,n;
  int a[100];
  cin>>n;
  for(int i=0;i<n;i++)
  {
  	cin>>a[i];
  }
  if(n==3)
  {
     for(int i=0;i<n;i++)
	 {
	 	if(a[i]!=a[i+1])
	 	{
	 		cout<<i+2;
		 }
	  }
  	return 0;
  }

  if(n%2==0)
  t=n/2;
  else
  t=n/2+1;
  cout<<t;

	return 0;
}


#include<bits\stdc++.h>
using namespace std;
int main()
{
	int l=0,t=0,k=0,j=0,n,a[1000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]%2==0)
		{
		k++;
		l=i;
		}
		else
		{
		j=i;
		t++;
	}
	}
  if(k>t)
  cout<<--l;
  else
  cout<<--j;

	return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t,n;
  int a[100];
  cin>>n;
  for(int i=0;i<n;i++)
  {
  	cin>>a[i];
  }
  if(n%2==0)
  t=n/2;
  else
  t=n/2+1;
  cout<<t;

	return 0;
}


#include<bits\stdc++.h>
using namespace std;
int main()
{
	int l=0,t=0,k=0,j=0,n,a[1000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]%2==0)
		{
		k++;
		l=i+1;
		}
		else
		{
		j=i+1;
		t++;
	}
	}
  if(k==1)
  cout<<l;
  if(t==1)
  cout<<j;

	return 0;
}


#include<iostream>
using namespace std;
int main()
{
  int t,n;
  int a[100];
  cin>>n;
  for(int i=0;i<n;i++)
  {
  	cin>>a[i];
  }
  if(n==3)
  {
  	cout<<"1";
  	return 0;
  }

  if(n%2==0)
  t=n/2;
  else
  t=n/2+1;
  cout<<t;

	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;

int main()
{
    fast
	int n;
	cin>>n;
	int arr[n];
	getarray(arr,n);
	int cnt=0,k=0,p=0,kk=0;
	for(int i=0;i<n;i++)
	{
		if(arr[i]%2!=0)
		{
			cnt++;
			k=min(i,k);
		}
		else
		{
			kk++;
			p=min(i,p);
		}
	}

	if(cnt>=kk)
	{
		cout<<p+1;
	}
	else
	{
		cout<<k+1;
	}
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;

int main()
{
    fast
	int n;
	cin>>n;
	int arr[n];
	getarray(arr,n);
	int cnt=0,k=9999999,p=999999,kk=0;
	for(int i=0;i<n;i++)
	{
		if(arr[i]%2!=0)
		{
			cnt++;
			k=min(i,k);
		}
		else
		{
			kk++;
			p=min(i,p);
		}
	}

	if(cnt>=kk)
	{
		cout<<p+1;
	}
	else
	{
		cout<<k+1;
	}
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;

int main()
{
    fast
	int n;
	cin>>n;
	int arr[n];
	getarray(arr,n);
	for(int i=0;i<n;i++)
	{
		if(arr[i]%2!=0)
		{
			cout<<i+1<<"\n";
			return 0;
		}
	}
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;

int main()
{
    fast
	int n;
	cin>>n;
	int arr[n];
	getarray(arr,n);
	for(int i-=0;i<n;i++)
	{
		if(arr[i]%2!=0)
		{
			cout<<i+1<<"\n";
			return 0;
		}
	}
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;

int main()
{
    fast
	int n;
	cin>>n;
	int arr[n];
	getarray(arr,n);
	int cnt=0,k=0,p=0,kk=0;
	for(int i=0;i<n;i++)
	{
		if(arr[i]%2!=0)
		{
			cnt++;
			k=min(i,k);
		}
		else
		{
			kk++;
			p=min(i,p);
		}
	}

	if(cnt>=kk)
	{
		cout<<k;
	}
	else
	{
		cout<<p;
	}
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define getarray(a,n)  for(int i=0;i<n;i++) cin>>a[i]
#define ll long long
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vi vector<int>
using namespace std;

int main()
{
    fast
	int n;
	cin>>n;
	int arr[n];
	getarray(arr,n);
	int cnt=0,k=0,p=0,kk=0;
	for(int i=0;i<n;i++)
	{
		if(arr[i]%2!=0)
		{
			cnt++;
			k=min(i,k);
		}
		else
		{
			kk++;
			p=min(i,p);
		}
	}

	if(cnt>=kk)
	{
		cout<<k+1;
	}
	else
	{
		cout<<p+1;
	}
    return 0;
}


#include <iostream>

using namespace std;

int a[100];
int odd[100];
int even[100];

int main()
{
    int n, b;
    int e = 0, o = 0;
    int cnte = 0, cnto = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        a[i] = b;
        if(a[i] % 2 == 0){
            cnte++;
            e = a[i];
        }else{
            cnto++;
            o = a[i];
        }
    }
    if(cnto > cnte){
        cout << a[e];
    }else if(cnto < cnte){
        cout << a[o];
    }-

}


#include <iostream>

using namespace std;

int a[100];
int odd[100];
int even[100];

int main()
{
    int n, b;
    int e = 0, o = 0;
    int cnte = 0, cnto = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        a[i] = b;
        if(a[i] % 2 == 0){
            cnte++;
            e = a[i];
        }else{
            cnto++;
            o = a[i];
        }
    }
    if(cnto > cnte){
        cout << a[e];
    }else if(cnto < cnte){
        cout << a[o];
    }

}


#include <iostream>

using namespace std;

int a[100];
int odd[100];
int even[100];
int main()
{
    int n, b;
    int e = 0, o = 0;
    int cnte = 0, cnto = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        a[i] = b;
        if(a[i] % 2 == 0){
            even[e] = b;
            e++;
            cnte++;
        }else{
            odd[0] = b;
            o++;
            cnto++;
        }
    }
    if(cnto > cnte){
        cout << even[0];
    }else if(cnto < cnte){
        cout << odd[0];
    }
}


#include <iostream>

using namespace std;

int a[100];
int odd[100];
int even[100];
int main()
{
    int n, b;
    int e = 0, o = 0;
    int cnte = 0, cnto = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        a[i] = b;
        if(a[i] % 2 == 0){
            even[e] = b;
            e++;
            cnte++;
        }else{
            odd[0] = b;
            o++;
            cnto++;
        }
    }
    if(cnto > cnte){
        cout << e[0];
    }else if(cnto < cnte){
        cout << o[0];
    }
}


#include <iostream>

using namespace std;

int a[100];

int main()
{
    int n, b;
    int e = 0, o = 0;
    int cnte = 0, cnto = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        a[i] = b;
        if(a[i] % 2 == 0){
            cnte++;
            e = i;
        }else{
            cnto++;
            o = i;
        }
    }
    if(cnto > cnte){
        cout << a[e];
    }else if(cnto < cnte){
        cout << a[o];
    }

}


#include <iostream>

using namespace std;

int a[100];
int odd[100];//��������
int even[100];//������

int main()
{
    int n, b;
    int e = 0, o = 0;
    int cnte = 0, cnto = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        a[i] = b;
        if(a[i] % 2 == 0){
            even[e] = b;
            e++;
            cnte++;
        }else{
            odd[0] = b;
            o++;
            cnto++;
        }
    }
    if(cnto > cnte){
        cout << e[0];
    }else if(cnto < cnte){
        cout << o[0];
    }
}


#include <bits/stdc++.h>

using namespace std;

int odd_quantity, even_quantity, last_odd_position, last_even_position, n, k;

int main(){
    cin >> n;
    for(int i = 0; i < n;i++){
        cin >> k;
        if(k % 2 == 0){
            even_quantity++;
            last_even_position = i + 1;
        }
        else{
            odd_quantity++;
            last_odd_position = i + 1;
        }
    }
    if(odd_quantity == 1){
        cout << last_odd_position;
    }
    else{
        cout << last_even_position;
    }
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arrays[n];
    for (int num = 0; num < n; num++)
    {
        cin >> arrays[num];
    }
    int change = 0;
    for (int nums = 0; nums < n; nums++)
    {
        if (nums > 0)
        {
            if ((arrays[nums-1] + arrays[nums]) % 2 == 1)
            {
                change = nums;
                if (change == 1 && nums == n -1)
                    change = nums + 1;
            }
        }
    }
    cout << change;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arrays[n];
    for (int num = 0; num < n; num++)
    {
        cin >> arrays[num];
    }
    int change = 0;
    int number = 0
    for (int nums = 0; nums < n; nums++)
    {
        if (nums > 0)
        {
            if ((arrays[nums-1] + arrays[nums]) % 2 == 1)
            {
                change = nums;
                number++
                if (nums == n - 1 && number == 1)
                    change = nums + 1;
            }
        }
    }
    cout << change;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arrays[n];
    for (int num = 0; num < n; num++)
    {
        cin >> arrays[num];
    }
    int change = 0;
    for (int nums = 0; nums < n; nums++)
    {
        if (nums > 0)
        {
            if ((arrays[nums-1] + arrays[nums]) % 2 == 1)
            {
                change = nums;
                if (nums == n - 1)
                    change = nums + 1;
            }
        }
    }
    cout << change;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arrays[n];
    for (int num = 0; num < n; num++)
    {
        cin >> arrays[num];
    }
    int change = 0;
    for (int nums = 0; nums < n; nums++)
    {
        if (nums > 0)
        {
            if ((arrays[nums-1] + arrays[nums]) % 2 == 1)
            {
                change = nums;
            }
        }
        if (nums == n-1 && change == 1)
            change = nums+1;
    }
    cout << change;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arrays[n];
    for (int num = 0; num < n; num++)
    {
        cin >> arrays[num];
    }
    int change = 0;
    int number = 0;
    for (int nums = 0; nums < n; nums++)
    {
        if (nums > 0)
        {
            if ((arrays[nums-1] + arrays[nums]) % 2 == 1)
            {
                change = nums;
                number++;
                if (nums == n - 1 && number == 1)
                    change = nums + 1;
            }
        }
    }
    cout << change;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arrays[n];
    for (int num = 0; num < n; num++)
    {
        cin >> arrays[num];
    }
    int change = 0;
    for (int nums = 0; nums < n; nums++)
    {
        if (nums > 0)
        {
            if ((arrays[nums-1] + arrays[nums]) % 2 == 1)
            {
                change = nums;
            }
        }
    }
    cout << change;
    return 0;
}


        // This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
        // ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
        // File Name: Codeforces-25A.cpp
        // Problem Link:

        // Author : Suvash Kumar Sumon

        #include<bits/stdc++.h>
        using namespace std;

        #define fio freopen("input.txt","r",stdin);
        void FIO()
        {
        #ifndef _offline
            freopen("input.txt", "r", stdin);
            //freopen("output.txt", "w", stdout);
        #endif
        }
        int main()
        {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            FIO();
            int n, i, a, b = 0, k, l,c = 0 ;
            cin>>n;
            for (i=0; i<n; i++)
            {
                cin>>a;
                if (a%2==0)
                    b++,k=i+1;
                else
                    c++,l=i+1;
            }
            if (b==1)
                cout<<k;
            else
                cout<<l;

            return 0;
        }


// This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
// ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
// File Name: Codeforces-25A.cpp
// Problem Link:

// Author : Suvash Kumar Sumon

#include<bits/stdc++.h>
using namespace std;

#define fio freopen("input.txt","r",stdin);
void FIO()
{
#ifndef _offline
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //FIO();

    int n;
    cin>>n;
    int array[n];
    for(int i=0; i<n; i++)
        cin>>array[i];
    for(int i=1; i<n; i++)
    {
        if((array[i]-array[i-1])%2==1)
        {
            cout<<i+1;
            break;
        }
    }

    return 0;
}


// This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
// ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
// File Name: Codeforces-25A.cpp
// Problem Link:

// Author : Suvash Kumar Sumon

#include<bits/stdc++.h>
using namespace std;

#define fio freopen("input.txt","r",stdin);
void FIO()
{
#ifndef _offline
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    FIO();
    int i, n;
    cin>>n;
    for (i=0; i<n; i++)
    {
        cin>>a;
        if (a%2==0)
            b++,k=i+1;
        else
            c++,l=i+1;
    }
    if (b==1)
        cout<<k;
    else
        cout<<l;

    return 0;
}


// This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
// ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
// File Name: Codeforces-25A.cpp
// Problem Link:

// Author : Suvash Kumar Sumon

#include<bits/stdc++.h>
using namespace std;

#define fio freopen("input.txt","r",stdin);
void FIO()
{
#ifndef _offline
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    FIO();

    int n;
    cin>>n;
    int array[n];
    for(int i=0; i<n; i++)
        cin>>array[i];
    for(int i=1; i<n; i++)
    {
        if((array[i]-array[i-1])%2==1)
        {
            cout<<i+1;
            break;
        }
    }

    return 0;
}


    // This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
    // ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
    // File Name: Codeforces-25A.cpp
    // Problem Link:

    // Author : Suvash Kumar Sumon

    #include<bits/stdc++.h>
    using namespace std;

    #define fio freopen("input.txt","r",stdin);
    void FIO()
    {
    #ifndef _offline
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    }
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        //FIO();
        int n, i, a, b = 0, k, l,c = 0 ;
        cin>>n;
        for (i=0; i<n; i++)
        {
            cin>>a;
            if (a%2==0)
                b++,k=i+1;
            else
                c++,l=i+1;
        }
        if (b==1)
            cout<<k;
        else
            cout<<l;

        return 0;
    }


// This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
// ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
// File Name: Codeforces-25A.cpp
// Problem Link:

// Author : Suvash Kumar Sumon

#include<bits/stdc++.h>
using namespace std;

#define fio freopen("input.txt","r",stdin);
void FIO()
{
#ifndef _offline
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //FIO();
    int n, i, a, b, k, l;
    cin>>n;
    for (i=0; i<n; i++)
    {
        cin>>a;
        if (a%2==0)
            b++,k=i+1;
        else
            c++,l=i+1;
    }
    if (b==1)
        cout<<k;
    else
        cout<<l;

    return 0;
}


// This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
// ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
// File Name: Codeforces-25A.cpp
// Problem Link:

// Author : Suvash Kumar Sumon

#include<bits/stdc++.h>
using namespace std;

#define fio freopen("input.txt","r",stdin);
void FIO()
{
#ifndef _offline
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    FIO();

    cin>>n;
    for (i=0; i<n; i++)
    {
        cin>>a;
        if (a%2==0)
            b++,k=i+1;
        else
            c++,l=i+1;
    }
    if (b==1)
        cout<<k;
    else
        cout<<l;

    return 0;
}


// This code is generated by ProgAst on Sun Apr 12 19:40:20 BDT 2020
// ProgAst Developer : Suvash Kumar Sumon, suvashkumar.naogaon@gmail.com
// File Name: Codeforces-25A.cpp
// Problem Link:

// Author : Suvash Kumar Sumon

#include<bits/stdc++.h>
using namespace std;

#define fio freopen("input.txt","r",stdin);
void FIO()
{
#ifndef _offline
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    FIO();
    int n;
    cin>>n;
    for (i=0; i<n; i++)
    {
        cin>>a;
        if (a%2==0)
            b++,k=i+1;
        else
            c++,l=i+1;
    }
    if (b==1)
        cout<<k;
    else
        cout<<l;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[n];
   int odd=0,even=0;

   int index = 0;
   for(int i=0; i<n; i++)cin>>a[i];

   for(int i=0; i<n; i++)
   {
       if(a[i]%2)
       {
           odd++;
           if(even>=odd){
                index=i;
           }
       }

       else{

           even++;
           if(odd>=even){
               index=i;
           }

       }

   }

   cout<<index+1;

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[n];
   int odd=0,even=0;
   int flag=0;
   int index = 0;
   for(int i=0; i<n; i++)
   {
       cin>>a[i];

       if(a[i]%2){
            odd++;
        if(odd>1&&flag==1){
                index=i-1;break;}
        flag=0;
       }
        else{
            even++;
            if(even>1&&flag==0){
                index=i-1;break;}
            flag=1;
        }
   }

   cout<<index+1;

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[n];
   int odd=0,even=0;

   int index = 0;
   for(int i=0; i<n; i++)cin>>a[i];

   for(int i=0; i<n; i++)
   {
       if(a[i]%2)
       {
           odd++;
           if(even>=odd){
                index=i;
           }
       }

       else{

           even++;
           if(odd>=even){
               index=i;
           }

       }

   }
    if(index==1)cout<<index;
    else
   cout<<index+1;

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[n];
   int odd=0,even=0;
   int flag=0;
   int index = 0;
   for(int i=0; i<n; i++)
   {
       cin>>a[i];

       if(a[i]%2){
            odd++;
        if(odd>1&&flag==1){
                index=i;break;}
        flag=0;
       }
        else{
            even++;
            if(even>1&&flag==0){
                index=i;break;}
            flag=1;
        }
   }

   cout<<index;

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[n];
   int odd=0,even=0;

   int index = 0;
   for(int i=0; i<n; i++)cin>>a[i];

   for(int i=0; i<n; i++)
   {
       if(a[i]%2)
       {
           odd++;
           if(even>=odd){
                index=i;
           }
       }

       else{

           even++;
           if(odd>=even){
               index=i;
           }

       }

   }
    if(index=1)cout<<index;
    else
   cout<<index+1;

   return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a;
   int odd=0,even=0;
    int lodd=0,leven=0;
    for(int i=1; i<=n; i++){
        cin>>a;
        if(a%2)
        {
            odd++;
            lodd=i;
        }
        else
        {
            even++;
            leven=i;
        }
    }
    if(even==1)
        cout<<leven;
    else
        cout<<lodd;
   return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[n];
   int odd=0,even=0;

   int index = 0;
   for(int i=0; i<n; i++)cin>>a[i];

   for(int i=0; i<n; i++)
   {
       if(a[i]%2)
       {
           odd++;
           if(even>1){
                index=i;
                break;
           }
       }

       else{

           even++;
           if(odd>1){
               index=i;
               break;
           }

       }

   }

   cout<<index+1;

   return 0;
}


#include <iostream>
using namespace std;

int main(){
    int n, a, e = 0, ei, o = 0, oi;
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a;
        if(a % 2 == 0){
            ++e;
            ei = i;
        }
        else{
          ++o;
          oi = i;
        }
        if(e > 1 && o == 1) return oi;
        else if(o > 1 && e == 1) return ei;
}


#include <iostream>
using namespace std;

int main()
{
    int n, e = 0, ei, o = 0, oi, arr[200];
    cin >> n;
    for (int i = 0; i<n; cin>> arr[i++])
        ;
    for (int i = 0; i < n; ++i)
    {
        if (arr[i] % 2 == 0)
        {
            ++e;
            ei = i + 1;
        }
        else
        {
            ++o;
            oi = i + 1;
        }
        if (e > 1 && o == 1)
            return oi;
        else if (o > 1 && e == 1)
            return ei;
    }
}


#include <iostream>
using namespace std;

int main()
{
    int n, a, e = 0, ei, o = 0, oi;
    cin >> n;
    int arr[n];
    for (int i = 0; i<n; cin>> arr[i++])
        ;
    for (int i = 0; i < n; ++i)
    {
        if (arr[i] % 2 == 0)
        {
            ++e;
            ei = i + 1;
        }
        else
        {
            ++o;
            oi = i + 1;
        }
        if (e > 1 && o == 1)
            return oi;
        else if (o > 1 && e == 1)
            return ei;
    }
}


import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Test {
    public static void main(String[] args) {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.ni();
        double k = in.ni();
        double[] arr = new double[n];
        for(int i=0;i<n;++i)
            arr[i] = in.ni();
        Arrays.sort(arr);
        int count = 0;
        for(int i=0;i<n;++i){
            //out.println(i+" "+k);
            if(k>=(arr[i]/2)) {
                k = Math.max(k,arr[i]);
                continue;

            }
            while(k<(arr[i]/2)){
                ++count;
                k*=2;
            }
            k = Math.max(k,arr[i]);
        }
        out.println(count);
        out.close();

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(){
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String n(){
            while (st == null || !st.hasMoreElements()) {
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {}
            }
            return st.nextToken();
        }

        int ni()
        {
            return Integer.parseInt(n());
        }

        long nl()
        {
            return Long.parseLong(n());
        }

        double nd()
        {
            return Double.parseDouble(n());
        }

        String nli() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {}
            return str;
        }
    }
}


import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Test {
    public static void main(String[] args) {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.ni();
        double k = in.ni();
        double[] arr = new double[n];
        for(int i=0;i<n;++i)
            arr[i] = in.ni();
        Arrays.sort(arr);
        int count = 0;
        for(int i=0;i<n;++i){
            //out.println(i+" "+k);
            if(k>=(arr[i]/2)) {
                k = Math.max(k,arr[i]);
                continue;

            }
            while(k<(arr[i]/2)){
                ++count;
                k*=2;
            }
        }
        out.println(count);
//        for(int i=0;i<n;++i)
//            out.print(arr[i]+" ");
        out.close();

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(){
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String n(){
            while (st == null || !st.hasMoreElements()) {
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {}
            }
            return st.nextToken();
        }

        int ni()
        {
            return Integer.parseInt(n());
        }

        long nl()
        {
            return Long.parseLong(n());
        }

        double nd()
        {
            return Double.parseDouble(n());
        }

        String nli() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {}
            return str;
        }
    }
}


import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Test {
    public static void main(String[] args) {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.ni();
        double k = in.ni();
        double[] arr = new double[n];
        for(int i=0;i<n;++i)
            arr[i] = in.ni();
        Arrays.sort(arr);
        int count = 0;
        for(int i=0;i<n;++i){
            if(k>=(arr[i]/2))
                continue;
            while(k<(arr[i]/2)){
                ++count;
                k*=2;
            }
        }
        out.println(count);
        out.close();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(){
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String n(){
            while (st == null || !st.hasMoreElements()) {
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {}
            }
            return st.nextToken();
        }

        int ni()
        {
            return Integer.parseInt(n());
        }

        long nl()
        {
            return Long.parseLong(n());
        }

        double nd()
        {
            return Double.parseDouble(n());
        }

        String nli() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {}
            return str;
        }
    }
}


import java.io.*;
import java.util.*;

/**
 * Created by Katushka on 11.03.2020.
 */
public class B {
    static int[] readArray(int size, InputReader in) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextInt();
        }
        return a;
    }

    static long[] readLongArray(int size, InputReader in) {
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextLong();
        }
        return a;
    }

    static void sortArray(long[] a) {
        Random random = new Random();

        for (int i = 0; i < a.length; i++) {
            int randomPos = random.nextInt(a.length);
            long t = a[i];
            a[i] = a[randomPos];
            a[randomPos] = t;
        }
        Arrays.sort(a);
    }

    static int binSearchLongRight(long[] list, long key, int start, int end) {
        int l = start - 1;
        int r = end;
        while (l < r - 1) {
            int m = (l + r) / 2;
            if (list[m] <= key) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public static void main(String[] args) throws FileNotFoundException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = in.nextInt();
        long k = in.nextLong();

        long[] a = readLongArray(n, in);
        sortArray(a);

        int ind = binSearchLongRight(a, 2 * k, 0, a.length);
        if (ind < a.length && ind >= 0) {
            k = Math.max(a[ind], k);
        }
        int count = 0;

        while (k * 2 < a[n - 1]) {
            int ind2 = binSearchLongRight(a, 2 * k, 0, a.length);
            if (ind == ind2) {
                count++;
                k = 2 * k;
            } else {
                ind = ind2;
                k = a[ind];
            }
        }
        out.println(count);

        out.close();
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }
    }
}


import utils.Template;

import java.io.*;
import java.util.*;

/**
 * Created by Katushka on 11.03.2020.
 */
public class B {
    static int[] readArray(int size, InputReader in) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextInt();
        }
        return a;
    }

    static long[] readLongArray(int size, InputReader in) {
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextLong();
        }
        return a;
    }

    static void sortArray(long[] a) {
        Random random = new Random();

        for (int i = 0; i < a.length; i++) {
            int randomPos = random.nextInt(a.length);
            long t = a[i];
            a[i] = a[randomPos];
            a[randomPos] = t;
        }
        Arrays.sort(a);
    }

    static int binSearchLongRight(long[] list, long key, int start, int end) {
        int l = start - 1;
        int r = end;
        while (l < r - 1) {
            int m = (l + r) / 2;
            if (list[m] <= key) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public static void main(String[] args) throws FileNotFoundException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = in.nextInt();
        long k = in.nextLong();

        long[] a = readLongArray(n, in);
        sortArray(a);

        int ind = binSearchLongRight(a, 2 * k, 0, a.length);
        if (ind < a.length && ind > 0) {
            k = Math.max(a[ind], k);
        }
        int count = 0;

        while (k * 2 < a[n - 1]) {
            int ind2 = binSearchLongRight(a, 2 * k, 0, a.length);
            if (ind == ind2) {
                count++;
                k = 2 * k;
            } else {
                ind = ind2;
                k = a[ind];
            }
        }
        out.println(count);

        out.close();
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }
    }
}


import java.io.*;
import java.util.*;

/**
 * Created by Katushka on 11.03.2020.
 */
public class B {
    static int[] readArray(int size, InputReader in) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextInt();
        }
        return a;
    }

    static long[] readLongArray(int size, InputReader in) {
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextLong();
        }
        return a;
    }

    static void sortArray(long[] a) {
        Random random = new Random();

        for (int i = 0; i < a.length; i++) {
            int randomPos = random.nextInt(a.length);
            long t = a[i];
            a[i] = a[randomPos];
            a[randomPos] = t;
        }
        Arrays.sort(a);
    }

    static int binSearchLongRight(long[] list, long key, int start, int end) {
        int l = start - 1;
        int r = end;
        while (l < r - 1) {
            int m = (l + r) / 2;
            if (list[m] <= key) {
                l = m;
            } else {
                r = m;
            }
        }
        return l;
    }

    public static void main(String[] args) throws FileNotFoundException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int n = in.nextInt();
        long k = in.nextLong();

        long[] a = readLongArray(n, in);
        sortArray(a);

        int ind = binSearchLongRight(a, 2 * k, 0, a.length);
        if (ind < a.length && ind > 0) {
            k = Math.max(a[ind], k);
        }
        int count = 0;

        while (k * 2 < a[n - 1]) {
            int ind2 = binSearchLongRight(a, 2 * k, 0, a.length);
            if (ind == ind2) {
                count++;
                k = 2 * k;
            } else {
                ind = ind2;
                k = a[ind];
            }
        }
        out.println(count);

        out.close();
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MULTIJUDGE {
	public static void main(String args[])
	throws IOException
	{
		Reader.init(System.in);
		int N=Reader.nextInt();
		int K=Reader.nextInt();
		int arr[]=new int[N];
		for(int i=0;i<N;i++)
		{
			arr[i]=Reader.nextInt();
		}
		Arrays.sort(arr);
		int count=0;
		for(int i=0;i<N;i++)
		{
			if(arr[i]<=2*K)
			{
				if(arr[i]>K)
					K=arr[i];
			}
			else
			{
				count++;
				K=2*K;
				i--;
			}
		}
		System.out.println(count);
	}

}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MULTIJUDGE {
	public static void main(String args[])
	throws IOException
	{
		Reader.init(System.in);
		int N=Reader.nextInt();
		int K=Reader.nextInt();
		int arr[]=new int[N];
		for(int i=0;i<N;i++)
		{
			arr[i]=Reader.nextInt();
		}
		Arrays.sort(arr);
		if(arr[N-1]>2*K)
			System.out.println(1);
		else
			System.out.println(0);
	}

}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MULTIJUDGE {
	public static void main(String args[])
	throws IOException
	{
		Reader.init(System.in);
		int N=Reader.nextInt();
		int K=Reader.nextInt();
		int arr[]=new int[N];
		for(int i=0;i<N;i++)
		{
			arr[i]=Reader.nextInt();
		}
		Arrays.sort(arr);
		boolean flag=true;
		for(int i=0;i<N;i++)
		{
			if(arr[i]<=2*K)
			{
				if(arr[i]>K)
					K=arr[i];
			}
			else
			{
				flag=false;
				break;
			}
		}
		if(flag)
			System.out.println(0);
		else
			System.out.println(1);
	}

}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}


import java.util.*;
public class Multi_Judge
{
    public static void main(String args[])
    {
        Scanner ob=new Scanner(System.in);
        int n=ob.nextInt();
        long k=ob.nextLong();
        long arr[]=new long[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=ob.nextLong();

        }

        Arrays.sort(arr);
        long count=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]<=2*k)
            {
                k=arr[i]>k?arr[i]:k;
            }
            else
            {
                while(k*2<arr[i])
                {
                    count++;
                    k=k*2;
                }
            }

        }
        System.out.println(count);

    }
}


import java.util.*;
public class Multi_Judge
{
    public static void main(String args[])
    {
        Scanner ob=new Scanner(System.in);
        int n=ob.nextInt();
        long k=ob.nextLong();
        long arr[]=new long[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=ob.nextLong();

        }

        Arrays.sort(arr);
        long count=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]<=2*k)
            {
                k=arr[i]>k?arr[i]:k;
            }
            else
            {
                while(k*2<arr[i])
                {
                    count++;
                    k=k*2;
                }
                k=arr[i]>k?arr[i]:k;
            }

        }
        System.out.println(count);

    }
}


import java.util.*;
public class Multi_Judge
{
    public static void main(String args[])
    {
        Scanner ob=new Scanner(System.in);
        int n=ob.nextInt();
        long k=ob.nextLong();
        long arr[]=new long[n];
        for(int i=0;i<n;i++)
        {
            arr[i]=ob.nextLong();

        }

        Arrays.sort(arr);
        long count=0;
        long max=2*k;
        for(int i=0;i<n;i++)
        {
            if(arr[i]<=k)
            {
                max=arr[i]*2>k?arr[i]*2:k;
            }
            else
            {
                while(k*2<arr[i])
                {
                    count++;
                    k=k*2;
                }
            }

        }
        System.out.println(count);

    }
}