
// Problem: D - Logical Expression
// Contest: AtCoder - AtCoder Beginner Contest 189
// URL: https://atcoder.jp/contests/abc189/tasks/abc189_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<ll>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rnd(x, y) uniform_ll_distribution<ll>(x, y)(rng)

void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}

#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else 
#define debug(...)
#endif

const ll max_n = 1e5 + 9;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	ll n;
	cin >> n;
	vector<string> vec(n);
	for(ll i = 0 ; i < n ; i++){
		cin >> vec[i];
	}
	
	ll dp[n+1][2];
	dp[0][0] = dp[0][1] = 1;
	for(ll i = 1 ; i <= n ; i++){
		if(vec[i-1] == "AND"){
			dp[i][0] = 2 * dp[i-1][0] + dp[i-1][1];
			dp[i][1] = dp[i-1][1];
		}
		else{
			dp[i][0] = dp[i-1][0];
			dp[i][1] = 2 * dp[i-1][1] + dp[i-1][0];
		}
	}
	
	cout << dp[n][1] << "\n";
}
signed main(){
	ll t = 1;
	// cin >> t;
	for(ll i = 1 ; i <= t ; i++){
		solve();
	}
}

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
ll n;
string s[1000];
int main()
{
   ll n,i,j,t,a,b,c,p,k,kk; 
    scanf("%lld",&n);
    for(i=1;i<=n;i++) cin>>s[i];
    ll sum=0;
    for(i=n;i>=1;i--) 
    {
    	 if(s[i]=="OR") sum+=(1ll<<i);
	}
	printf("%lld\n",++sum);
}