#include <bits/stdc++.h>
#include <bits/stdint-intn.h>

#include <algorithm>
#include <cstdint>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    if (s == "AND") {
      A[i] = 0;
    } else {
      A[i] = 1;
    }
  }

  int64_t count0 = 1;
  int64_t count1 = 1;
  for (int i = 0; i < N; i++) {
    int64_t next0 = 0;
    int64_t next1 = 0;
    if (A[i]) {
      // OR
      // 0 | 0 = 0
      // 0 | 1 = 1
      // 1 | 0 = 1
      // 1 | 1 = 1
      next0 = count0;
      next1 = count0 + count1 * 2;
    } else {
      // AND
      // 0 & 0 = 0
      // 0 & 1 = 0
      // 1 & 0 = 0
      // 1 & 1 = 1
      next0 = count0 * 2 + count1;
      next1 = count1;
    }
    count0 = next0;
    count1 = next1;
  }

  cout << count1 << endl;

  return 0;
}

//D
#include <bits/stdc++.h>
using namespace std;
#define sc scanf
#define pr printf
#define ll long long
#define int long long
#define mst(x) memset(x, 0 ,sizeof x)
#define FILE_OUT freopen("out", "w", stdout);
#define FILE_IN freopen("in", "r", stdin);
#define debug(a,b) cout<<a<<" : "<<b<<endl;
#define INF 0x3f3f3f3f3f3f 
const ll MAX_N = 1e5+5;
const ll mod = 1e9+7;
int N, M, K;

int arr[MAX_N];
char s[MAX_N];
int dp[MAX_N][2][2];

void solve(){
	sc("%lld", &N);
	dp[0][0][1] = 0;
	dp[0][0][0] = 1;
	dp[0][1][1] = 1;
	dp[0][1][0] = 0;
	for (int i = 1; i <= N; ++i){
		getchar();
		sc("%s", s);
		if (s[0]=='A'){
			dp[i][1][1] += dp[i-1][1][1] + dp[i-1][0][1];
			dp[i][1][0] += dp[i-1][1][0] + dp[i-1][0][0];
			dp[i][0][1] = 0;
			dp[i][0][0] += dp[i-1][1][0] + dp[i-1][1][1] + dp[i-1][0][1] + dp[i-1][0][0];
		}else{
			dp[i][1][1] += dp[i-1][1][1] + dp[i-1][0][1] + dp[i-1][1][0] + dp[i-1][0][0];
			dp[i][1][0] = 0;
			dp[i][0][1] += dp[i-1][1][1] + dp[i-1][0][1];
			dp[i][0][0] += dp[i-1][1][0] + dp[i-1][0][0];
		}
	}
	pr("%lld", dp[N][0][1]+dp[N][1][1]);
}

signed main()
{
	#ifndef ONLINE_JUDGE 
	FILE_OUT
	#endif
	int T = 1;//sc("%lld", &T);
	while (T--) solve();
	
	return 0;
}