#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=200020,mod=998244353;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
inline int qmo(int x){return x+(x>>31?mod:0);}
int n,m;
char s[maxn],t[maxn];
int main(){
	n=read();
	scanf("%s",s+1);
	FOR(i,1,n){
		t[++m]=s[i];
		if(m>=3 && t[m-2]=='f' && t[m-1]=='o' && t[m]=='x') m-=3;
	} 
	printf("%d\n",m);
}
#include <bits/stdc++.h>
using namespace std;

#define N 200000

int main()
{
	int n, p, q = 0;
	vector<bool> u(N+5, 0);
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &p);
		u[p] = 1;
		while (u[q]) ++q;
		printf("%d\n", q);
	}
}