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

#define make_it_fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define imn INT_MIN
#define imx INT_MAX

ld pi=3.14159265358979323846;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}

template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}

void _print() {cerr << "]\n";}

template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...) 20
#endif

vector<ll> seg;
ll power(ll a,ll b,ll m)
{
    a%=m;
    if(b==1)
    return a;
    if(b==0)
    return 1LL;
    ll ret=power(a,b/2,m);
    ret=(ret*ret)%m;
    if(b&1)
    ret=(ret*a)%m;
    return ret;
}

ll power(ll a,ll b)
{
    if(b==1)
    return a;
    if(b==0)
    return 1LL;
    ll ret=power(a,b/2);
    ret=(ret*ret);
    if(b&1)
    ret=(ret*a);
    return ret;
}

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

ll phi(ll n) // Euler-Totient Function
{
    ll result = n;
    for(ll i=2;i*i<=n;i++)
    {
        if (n%i==0)
        {
            while (n%i==0)
            n/=i;
            result/=i;
            result*=(i-1);
        }
    }
    if (n > 1)
    {
        result/=n;
        result*=(n-1);
    }
    return result;
}

ll findpar(ll x,ll par[])
{
    while(x!=par[x])
    {
        x=par[x];
    }
    return x;
}

ll construct(ll a[],ll s,ll e,ll i)
{
    if(s==e)
    {
        seg[i]=a[s];
        return seg[i];
    }
    ll mid=s+(e-s)/2;
    seg[i]=construct(a,s,mid,2*i+1)^construct(a,mid+1,e,2*i+2);
    return seg[i];
}

void update(ll node,ll val,ll s,ll e,ll i)
{
    if(s==e)
    {
        seg[i]=val;
        return;
    }
    ll mid=s+(e-s)/2;
    if(node<=mid)
    {
        update(node,val,s,mid,2*i+1);
    }
    else
    {
        update(node,val,mid+1,e,2*i+2);
    }
    seg[i]=seg[2*i+1]^seg[2*i+2];
}

ll query(ll l,ll r,ll s,ll e,ll i)
{
    if(e<l || s>r)
    return 0;
    if(s>=l && e<=r)
    return seg[i];
    ll mid=s+(e-s)/2;
    return (query(l,r,s,mid,2*i+1)^query(l,r,mid+1,e,2*i+2));
}

void answer_nikaal()
{
    ll n,i;
    cin>>n;
    string s[n];
    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }
    vector<ll> dp(n+1);
    if(s[0]=="OR")
    dp[1]=3;
    else
    dp[1]=1;
    for(i=1;i<n;i++)
    {
        if(s[i]=="OR")
        {
            dp[i+1]=2*dp[i]+((1LL<<(i+1))-dp[i]);
        }
        else
        {
            dp[i+1]=dp[i];
        }
    }
    // debug(dp);
    cout<<dp[n]<<endl;
}

int main()
{
    make_it_fast;
    int TEST_CASES=1;
    // cin>>TEST_CASES;
    while(TEST_CASES--)
    {
        answer_nikaal();
    }
    return 0;
}

#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a),i##end=(b);i<i##end;i++)
#define REP(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define RFOR(i,a,b) for(int i=(a),i##end=(b);i>i##end;i--)
#define RREP(i,a,b) for(int i=(a),i##end=(b);i>=i##end;i--)
typedef long long LL;

LL ans[2];
char s[5];
int main() {
	int n; scanf("%d",&n);
	ans[0]=ans[1]=1LL;
	while(n--) {
		scanf("%s",s);
		//printf("s=%s\n",s);
		if(!strcmp(s,"AND")) {
			ans[0]<<=1;
			ans[0]+=ans[1];
		} else if(!strcmp(s,"OR")) {
			ans[1]<<=1;
			ans[1]+=ans[0];
		} else assert(false);
	}
	printf("%lld\n",ans[1]);
	return 0;
}
