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

int main(){
  string s, t; cin >> s;
  deque<char> deq;
  bool rev = false;
  for(int i = 0; i < (int)s.size(); ++i){
    if(s[i] == 'R'){rev = !rev;}
    else if(s[i] != 'R' && rev == false){deq.push_back(s[i]);}
    else{deq.push_front(s[i]);}    
  }
  if(rev == true){reverse(deq.begin(), deq.end());}
  
  stack<char> stk;
  char w;
  if(deq.size() == 0){cout << endl; return(0);}
  while(!deq.empty()){
    w = deq.front(); deq.pop_front();
    if(stk.empty() || stk.top() != w){stk.push(w);}
    else{stk.pop();}
  }
  
  int loopnum = stk.size();
  string ans;
  for(int i = 0; i < loopnum; ++i){
    ans.push_back(stk.top());
    stk.pop();
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = k; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const ll INF = (ll)1e16;
void chmin(ll &a, ll b) { a = min(a, b); }
void chmax(ll &a, ll b) { a = max(a, b); }

void solve() {
    int n;
    cin >> n;
    vector<string> S(n);
    rep(i,n) cin >> S[i];
    vector<ll> T(n+1), F(n+1);
    T[0] = 1;
    F[0] = 1;
    rep2(i,1,n+1) {
        if (S[i-1] == "OR") {
            T[i] = (1ll<<(i+1)) - F[i-1];
        } else {
            T[i] = T[i-1];
        }
        F[i] = (1ll<<(i+1)) - T[i];
    }
    cout << T[n] << endl;
}

int main() {
    solve();
    return 0;
}
