#include<bits/stdc++.h>
using namespace std;
#define DONTSYNC ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL) //dont use stdio with iostream functions //input and output are out of order now!
#define TEST unsigned long long T; cin>>T; while(T--)  //loop over each testcase
#define endl "\n"
#define fori(a,start,end) for(int a=start;a<end;a++)
#define forl(a,start,end) for(long long a=start;a<end;a++)
#define fi first
#define se second
typedef long long     ll;
typedef long double   ld;
typedef pair<int,int> pii;
typedef pair<ll,ll>   pll;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vii;
typedef vector<pll>   vll;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
const double PI = acos(-1);

void solve(){
    /* code */
    string s; cin>>s;
    list<char> l;
    int tm=1;
    fori(i,0,s.size()){
        if(s[i]=='R'){
            tm=1-tm;
        }
        else if(tm){
            if(l.size() && l.back()==s[i]){
                l.pop_back();
            }else{
                l.push_back(s[i]);
            }
        }
        else{
            if(l.size() && l.front()==s[i]){
                l.pop_front();
            }else{
                l.push_front(s[i]);
            }
        }
    }
    if(!tm){
        while(l.size()) {
            cout<<l.back();
            l.pop_back();
        }
        
    }else{
        for(char c:l) cout<<c;
    }
}

int main()
{
    DONTSYNC;
    // TEST
    solve();
    return 0;
}

#include<ctime>
#include<cstdio>
#include<cctype>
using namespace std;
const int N=2e5+10;
int read() {
	char c;
	int x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while (isdigit(c)){
		x=x*10+(c-48)*f;
		c=getchar();
	}
	return x;
}
char str[N],stack[N];
int n,f,o,res,top;
int main() {
	#ifndef ONLINE_JUDGE
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	res=n;
	scanf("%s",str+1);
	for(int i=1;i<=n;++i){
		switch(str[i]){
			case 'f':
				++top;
				stack[top]='f';
				break;
			case 'o':
				++top;
				stack[top]='o';
				break;
			case 'x':
				if(top&&stack[top]=='o'&&stack[top-1]=='f'){
					stack[top]=0;
					--top;
					stack[top]=0;
					--top;
					res-=3;
				}
				else{
					while(top){
						stack[top]=0;
						--top;
					}
				}
				break;
			default:
				while(top){
					stack[top]=0;
					--top;
				}
				break;
		}
	}
	printf("%d",res);
	//--------
	clock_t t2=clock();
	fprintf(stderr,"time:%0.3lfs",1.0*(t2-t1)/CLOCKS_PER_SEC);
	return 0;
}