#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
    vector<string> S;
    vector<vector<int>> dp;
    
    cin>>N;
    
    dp.resize(N+1, vector<int>(2));
	S.resize(N);
    
    dp[0][0] = dp[0][1] = 1;
    
    for(int i = 0; i < N; i++){
        cin>>S[i];
    }
	
    
    for(int i = 1; i <= N; i++){
        if(S[i-1] == "AND") {
            dp[i][0] = dp[i-1][0] * 2 + dp[i-1][1];
            dp[i][1] = dp[i-1][1];
        } else {
            dp[i][0] = dp[i-1][0];
            dp[i][1] = dp[i-1][1] * 2 + dp[i-1][0];
            
        }
    }
    
    cout<<dp[N][1]<<endl;
    
	return 0;
}
#include <iostream>
#include <cmath>
#include <memory.h>

using namespace std;
typedef long long LL;

int main() {
    int n;
    cin >> n;
    string s;
    LL ans = 1, p = 1;
    while (n--) {
        p <<= 1;
        cin >> s;
        if (s == "OR") {
            ans += p;
        }
    }
    cout << ans << endl;
}