#include <bits/stdc++.h>
 
#define ff first
#define ss second
#define mp make_pair
 
using namespace std;
 
typedef long long ll;

char v[65][5];
int n;
ll dp[65][2];
bool mark[65][2];

ll f(int i, int j) {
	if(i == n) return j;
	if(mark[i][j]) return dp[i][j];

	mark[i][j] = true;
	ll ans = 0;

	if(v[i][0] == 'A') {
		if(!j) ans = 2*f(i+1, 0);
		else ans = f(i+1, 1) + f(i+1, 0);
	}
	else {
		if(!j) ans = f(i+1, 0) + f(i+1, 1);
		else ans = 2*f(i+1, 1);
	}

	return dp[i][j] = ans;
}

int main () { 
	scanf("%d", &n);

	for(int i = 0; i < n; i++) {
		scanf(" %s", v[i]);
	}

	printf("%lld\n", f(0, true) + f(0, false));
 
	return 0;
}
#include<bits/stdc++.h>
using namespace std;

#define asll unsigned long long
#define ULL unsigned long long
#define ll long long
#define LL long long
#define ld long double
#define imt int
#define pii pair<int,int>
#define st first
#define fi first
#define nd second
#define se second
#define psbk(x) push_back(x);
#define pb push_back
#define For(x,a,b) if(a!=b){icdc=(b-a)/abs(b-a))}else{icdc=1};for(int x=(a);x!=(b+icdc);x+=icdc)
#define forp(x,a,b) if(b-a!=0){icdc=(b-a)/abs(b-a))}else{icdc=1};for(int x=(a);x!=(b);x+=icdc)
#define FOR(x,n) for(int x=0;x<(n);x++)
#define m_p make_pair
int icdc;

#define kj <<" "<<
#define kjb <<" ";
#define dg <<","<<
#define ml <<'\n';
#define co cout<<
#define ter cout<<endl;
#define sibi cout<<"TES"<<endl;
#define tes(x) cout<<"TES"<<x<<endl;
#define kpr(x) cout<<"("<<x.st dg x.nd <<")" ml

ULL M=1e9+7;
LL b,m,k,tc;
LL p,q,r,t;
string s[105];
LL bemer[105];
LL salah[105];

LL fals(int p);

LL tru(int p){
	//sibi
	//co "t" ml
	LL ret=0;
	if(p==0){
		bemer[p]=1;
		return 1;
	}
	if(bemer[p]!=-1){
		return bemer[p];
	}
	if(s[p-1]=="AND"){
		ret=tru(p-1);
		bemer[p]=ret;
		return bemer[p];
	}
	else{
		ret+=2*tru(p-1);
		//sibi
		ret+=fals(p-1);
		bemer[p]=ret;
		return bemer[p];
	}
}

LL fals(int p){
	//co "f" kj p ml
	LL ret=0;
	if(p==0){
		salah[p]=1;
		return 1;
	}
	if(salah[p]!=-1){
		return salah[p];
	}
	if(s[p-1]=="OR"){
		salah[p]=fals(p-1);
		//co "kh" kj p kj fals(p-1) ml
		return salah[p];
	}
	else{
		LL ret=0;
		ret+=2*fals(p-1);
		ret+=tru(p-1);
		salah[p]=ret;

		return salah[p];
	}
}

int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(0);
	//freopen("input.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
	//srand(time(0));
	cin>>b;
	//cin.ignore();
	//sibi
	FOR(i,b){
		//sibi
		cin>>s[i];
		//operator ke i untuk ngoperasike i sama i+1
	}
	//sibi
	memset(bemer,-1,sizeof(bemer));
	memset(salah,-1,sizeof(salah));
	//cout<<b<<endl;
	
	r=tru(b);
	FOR(i,b+1){
		//co bemer[i] kj salah[i] ml
	}
	cout<<r<<endl;
}
/*

*/

