#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using ml = map<ll, ll>;
using vl = vector<ll>;
using vp = vector<pl>;
using vvl = vector<vl>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define fore(i_in,a) for (auto& i_in: a)
#define forp(x,y,a) for(auto& [x, y]: a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pq(T) priority_queue<T, vector<T>, greater<T>>
#define fio() cin.tie(nullptr);ios::sync_with_stdio(false);
#define CEIL(a, b) (a+b-1)/b;
#define offset_FLOOR(a, b) (a-1)/b;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<(int)v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
template<class T> bool chmax(T &a, const T &b) {if (a<b) { a = b; return true; } return 0;}
template<class T> bool chmin(T &a, const T &b) {if (a>b) { a = b; return true; } return 0;}
template<class T> void print(const T &t) { cout << t << "\n"; }

ll n, ans;
string s;

int main() {
    fio(); cin>>n;
    vvl dp(n+1, vl(2, 0));
    dp[0][0]=1;dp[0][1]=1;
    rep(i,n) {
        cin>>s;
        if (s=="OR") {
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][0] + 2 * dp[i][1];
        }
        else {
            dp[i+1][0] = 2 * dp[i][0] + dp[i][1];
            dp[i+1][1] = dp[i][1];
        }
    }
    print(dp[n][1]);
}
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<bitset>
#include<vector>
#include<queue>
#include<deque>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
inline int read(){
	int x=0;
	bool f=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-'){
			f=1;
		}
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	if(f){
		return -x;
	}
	return x;
}
inline uint readu(){
	uint x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x;
}
void fp(){
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
char a[500005],t[1000005],tt[500005];
bool b[1000005];
int main(){
    //fp();
    int i,len,zz=500000,zz1=499999,fz=1,zz2=1;
	scanf("%s",a+1);
	len=strlen(a+1); 
	for(i=1;i<=len;i++){
		if(a[i]=='R'){
			fz^=1;
		}
		else{
			if(fz){
				t[++zz1]=a[i];
			}
			else{
				t[--zz]=a[i];
			}
		} 
	}
	if(!fz){
		for(i=zz1;i>=zz;i--){
		if(tt[zz2]==t[i]){
			zz2--;
		}
		else{
			tt[++zz2]=t[i];
		}
	}
	for(i=2;i<=zz2;i++){
		printf("%c",tt[i]);
	}
	return 0;
	} 
	for(i=zz;i<=zz1;i++){
		if(tt[zz2]==t[i]){
			zz2--;
		}
		else{
			tt[++zz2]=t[i];
		}
	}
	for(i=2;i<=zz2;i++){
		printf("%c",tt[i]);
    }
    return 0;
}