/*

 Remember, Hope is a good thing... May be the best of things... and No Good thing ever Dies !!!

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cout.tie(0);
#define endl "\n"
#define MOD1 1000000007
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define fi first
#define se second
const ll inf=(1LL<<60)-1;
const ll mxn=1e5+7;
int dx[]= {-1,1,0,0};
int dy[]= {0,0,-1,1};
const ll limit=1e6+5;
/*
sort(v.begin(),v.end(),[&](const pair<ll,ll>&a,const pair<ll,ll>&b)
   {
       if(a.first==b.first)
           return a.second<b.second;
       else
           return a.first>b.first;
   });
*/

void solve()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    ll c,d,i,j,p,q,k,l,r,w,h,n,m,x,y,z=0,cnt=0,ans=0;
    cin>>n;
    vector<ll>v(1LL<<n);
    for(ll i=0;i<1LL<<n;i++)
        cin>>v[i];
        m=1LL<<n;
    x=max_element(v.begin(),v.begin()+m/2)-v.begin();
    y=max_element(v.begin()+m/2,v.end())-v.begin();
    if(v[x]<v[y])
        ans=x+1;
    else
        ans=y+1;
    cout<<ans<<endl;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}


//JOY SREE RAM
//JOY SREE GANESH
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define all(v) begin(v),end(v)
#define vs vector<string>
#define ll long long
#define all(v) begin(v),end(v)
#define vs vector<string>
#define qi queue<int>
#define pqi priority_queue<int>
#define sti stack<int>
#define si set<int>
#define pii pair<long,long>
#define mpi map<int,int>
#define mps map<string,int>
#define mpc map<char,int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pi pair<int,int>
#define vpi vector<pair<ll,ll> >
#define np next_permutation
#define mod 1000000007
#define INF 1e9
#define kom -10000000
#define fst ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
const int mxn =1e7 + 5;
ll cc_size;
int mark[mxn];
set<int> primes;
void sieve(){
    for(int i=4; i<mxn; i+=2)mark[i] = 1;
    for(int i=3; i*i<mxn; i+=2){
        if(mark[i] == 0){
            for(int j=i*i; j<mxn; j+=(i*2))mark[j] = 1;
        }
    }
}

bool is_prime(int x) {
    if(x == 1) return false;
    for(int i = 2; i*i <= x; i++) {
        if(x % i == 0) return false;
    }
    return true;
}
bool cmp1(pii x, pii y){
  if(x.ff!=y.ff) return x.ff<y.ff;
  return x.ss>y.ss;
}
int vis[200005];
vi adj[200005];
void dfs(int u){
  cc_size++;
  vis[u]=1;
  for(auto v : adj[u]){
    if(vis[v])continue;
    dfs(v);
  }
}
int main(){
  vi v;int a;
  for(int i=0;i<3;i++){
    cin>>a;
    v.pb(a);
  }
  sort(all(v));
  cout<<v[2]+v[1]<<'\n';

  return 0;
}
