#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cassert>
#include <cmath>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

#define read_int(X) \
    ll X;           \
    scanf("%lld\n", &X);

#define read_two_int(X, Y) \
    ll X, Y;               \
    scanf("%lld %lld\n", &X, &Y);

#define read_three_int(X, Y, Z) \
    ll X, Y, Z;                 \
    scanf("%lld %lld %lld\n", &X, &Y, &Z);

#define read_four_int(X, Y, Z, W) \
    ll X, Y, Z, W;                \
    scanf("%lld %lld %lld %lld\n", &X, &Y, &Z, &W);

int main()
{
    ll N;
    scanf("%lld", &N);

    vector<string> S = vector<string>(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> S[i];
    }

    vector<ll> ans = vector<ll>(N + 1);
    ans[0] = 1;
    ll pow2 = 2;
    for (ll i = 0; i < N; i++)
    {
        ans[i + 1] = ans[i];
        if (S[i] == "OR")
            ans[i + 1] += pow2;
        pow2 *= 2;
    }

    printf("%lld\n", ans[N]);
}

#include<iostream>             
#include<vector>   
#include<bits/stdc++.h>
// #define mod 1000000007
#define pi 3.14159265358979
#define  PRE(x,p) cout<<setprecision(x)<<p; 
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl "\n"
#define high INT_MAX
#define low INT_MIN
#define ll long long int

using namespace std;


void showa(ll a[],ll n){ for(ll i=1;i<=n;i++) cout<<a[i]<<' ';  cout<<endl;  }
void showv(vector<ll>v){ for(ll i=0;i<v.size();i++) cout<<v[i]<<' '; cout<<endl;}

long long int xpoweryMOD(int x, int y, int mod)
{
  long long int res = 1;
  /*
  it depends sometimes on questions too,
  whether pow(0,0) is 1 or 0
  So change accordingly
  */
  if (x == 0)return 0;
  while (y)
  {
    if (y & 1)(res *= x) %= mod;
    y >>= 1;
    (x *= x) % mod;
  }
  return res;
}
int n;
ll po[65];
ll rec(vector<string>st,int index)
{
    if(!index)return 1;
    if(st[index]=="AND")
        return rec(st,index-1);
    else
        return po[index] + rec(st,index-1);
}
void solve() 
{ 
   ll i;
   cin>>n;
   vector<string>st(n+1);
   for(i=1;i<=n;i++)
   cin>>st[i];
   cout<<rec(st,n);

}
int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
 ll x=2;
 for(ll i=1;i<=61;i++)
   { po[i]=x;x=x*2;}
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

ll t=1;
// cin>>t;
for(ll test=1;test<=t;test++)
{
    // cout<<"CASE #"<<test<<": ";
    solve();
}

return 0;
}