//#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int N=101000;
const int inf=1e9+7;
inline long long read(void)
{
	char ch=getchar();long long sum=0;bool f=0;
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-'){f=1;ch=getchar();}
	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	if(f)sum=-sum;return sum;
}
int n;
string st;
int opt[N];
long long DP[N][2];
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		cin>>st;
		if(st[0]=='O')opt[i]=1;
		else opt[i]=2;
	}
	DP[0][1]=DP[0][0]=1;
	for(int i=1;i<=n;i++){
		if(opt[i]==1){
			DP[i][0]+=DP[i-1][0];
			DP[i][1]+=(DP[i-1][0]+DP[i-1][1]*2);
		}
		else {
			DP[i][0]+=DP[i-1][0]*2+DP[i-1][1];
			DP[i][1]+=DP[i-1][1];
		}
	}
	cout<<DP[n][1];return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
 ll n;
  cin >> n;
  string s;
  ll t = 1;
  ll f = 1;
  for(ll i = 0;i < n;i++){
    cin >> s;
    if(s == "AND"){
      f = f*2+t;
    } else {
      t = t*2+f;
    }
  }
    cout << t << endl;
  
}