#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define MOD 1000000007

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) {
        cin >> s[i];
    }
    ll b = 1, f = 1;
    rep(i, n) {
        if (s[i] == "AND") {
            f = b + 2 * f;
        } else {
            b = 2 * b + f;
        }
    }
    cout << b << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(ll i=a;i<n;i+=x)
#define forD(i,a,n,x) for(ll i=n-1;i>=a;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define init(a,x) memset(a,x,sizeof(a))

string s[61];
ll dp[102][2];

ll solve(ll n, bool val)
{
	if(n==0)return 1;

	if(dp[n][val]!=-1)return dp[n][val];

	if(s[n-1]=="OR")
	{
		if(val)return dp[n][val]= solve(n-1,false)+ 2*solve(n-1,true);
		else return dp[n][val]= solve(n-1,false);
	}
	else
	{
		if(val)return dp[n][val]= solve(n-1,true);
		else return dp[n][val]= 2*solve(n-1,false)+solve(n-1,true);
	}
}

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	
	ll n; cin>>n;
	init(dp,-1);
	forA(i,0,n,1)cin>>s[i];
	cout<<solve(n,true);
	return 0;
}