#include <bits/stdc++.h>

using i64 = int64_t;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::vector<int> s;
    int n;
    std::cin >> n;
    ++n;
    for (int i = 1; i < n; ++i) {
        std::string foo;
        std::cin >> foo;
        s.push_back(foo == "AND" ? 1 : 0);
    }

    std::vector<std::array<i64, 2>> dp(n);
    dp[0][0] = 1;
    dp[0][1] = 1;
    for (int i = 0; i < n - 1; ++i) {
        if (s[i] == 1) {
            dp[i + 1][1] += dp[i][1];
            dp[i + 1][0] += dp[i][0] + dp[i][1] + dp[i][0];
        } else {
            dp[i + 1][1] += dp[i][0] + dp[i][1] + dp[i][1];
            dp[i + 1][0] += dp[i][0];
        }
    }
    std::cout << dp[n - 1][1] << '\n';
    return 0;
}
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n; cin >> n;
  vector<int> a;
  
  long long ans = 1;
  for(long long i = 1; i <= n; ++i){
    string s; cin >> s;
    if(s == "OR"){ans += (long long)pow(2, i);}
  }  
  cout << ans << endl;
}
