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

int main()
{
	#ifndef  ONLINE_JUDGE
		freopen("tpl.txt","r",stdin);
	#endif
	int n; cin >> n;
  	vector<int> vc;
  	for(int i = 0; i < 1 << n; i++)
    {
    	int tmp; cin >> tmp;
      	vc.push_back(tmp);
    }
  	int max_pos = max_element(vc.begin(),vc.end()) - vc.begin();
  	int half = 1 << (n-1);
  	auto start = max_pos < half ? vc.begin() + half : vc.begin();
  	int ans = max_element(start,start + half) - vc.begin();
  	cout << ans + 1<< endl;
  	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pin;

const int N = 2e5 + 5;

int n, ans, top = 0, stk[N];
char s[N];

template <typename T>
inline void read(T &X) {
    char ch = 0; T op = 1; 
    for (X = 0; ch > '9' || ch < '0'; ch = getchar())
        if (ch == '-') op = -1;
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        X = (X * 10) + ch - '0';
    X *= op;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("sample.in", "r", stdin);
#endif

    read(n);
    scanf("%s", s + 1);
    ans = n;
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'f') {
            stk[++top] = i;
        } else if (s[i] == 'o') {
            if (s[stk[top]] == 'o') top = 0;
            else stk[++top] = i;
        } else if (s[i] == 'x') {
            if (top < 2) top = 0;
            else {
                if (s[stk[top - 1]] = 'f' && s[stk[top]] == 'o') {
                    top -= 2;
                    ans -= 3;
                } else top = 0;
            }
        } else top = 0;
    }    
    printf("%d\n", ans);
    return 0;
}