#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ull unsigned long long
#define pii pair<int,int>
#define tiii tuple<int,int,int>
#define pll pair<long long, long long>
#define pdd pair<double, double>
#define s second
#define f first
#define pb push_back
#define oo 1000000000000ll


void solve(){
    int n; cin >> n;
    vector<int> dp[2];
    dp[0].resize(n+1);
    dp[1].resize(n+1);
    dp[0][0] = 1;
    dp[1][0] = 1;
    for (int i = 1; i <= n; ++i) {
        string str; cin >> str;
        if (str == "AND"){
            dp[1][i] = dp[1][i-1];
            dp[0][i] = dp[1][i-1] + 2*dp[0][i-1];
        }
        else{
            dp[1][i] = 2*dp[1][i-1] + dp[0][i-1];
            dp[0][i] = dp[0][i-1];
        }
    }

    cout << dp[1][n] << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    solve();

    return 0;

}

#include <bits/stdc++.h>

signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n; std::cin >> n;
    std::vector<int> op(n);
    for (auto &it : op) {
        std::string s; std::cin >> s;
        it = (s == "AND");
    }

    int64_t ans = 1, pw2 = 1;
    for (int i = 0; i < n; i++) {
        pw2 <<= 1;
        if (not op[i]) {
            ans += pw2;
        }
    }

    std::cout << ans << '\n';

    return 0;
}
