#include <bits/stdc++.h>

using namespace std;

//#define ONLINE_JUDGE
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define rep(z, x, y) for(int z=x;z<=y;++z)
#define repe(z, x, y) for(int z=x;z<y;++z)
#define repd(z, x, y) for(int z=x;z>=y;--z)
#define repde(z, x, y) for(int z=x;z>y;--z)
#define int long long

typedef long long ll;
typedef pair<int, int> PII;

const int INF = 0x3f3f3f3f;
const double eps = 1e-9;
const int mod = 1e9 + 7;

const int N = 65;

string op[N];

void solve()
{
    int n;
    cin >> n;
    vector<int> p;
    p.push_back(-1);
    rep(i, 1, n)
    {
        cin >> op[i];
        if(op[i] == "AND")
            p.push_back(i);
    }
    
    p.push_back(n + 1);
    int ans = 0;
    repd(i, p.size() - 1, 1)
    {

        int a = ((int)pow(2ll, p[i] - p[i - 1] - 1) - 1);
        int b = (int)pow(2ll, p[i - 1] + 1);
        ans += a * b;
    }

    cout << ans << endl;

}

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("IO/in.txt", "r", stdin);
        freopen("IO/out.txt", "w", stdout);
    #endif

    IOS;
    int t;
    solve();
}
#include <iostream>  // cin cout
#include <string>    // string

int main()
{
  int n;
  std::cin >> n;
  unsigned long long res = 1;

  for (int i = 0; i < n; i++)
  {
    std::string x;
    std::cin >> x;
    if (x == "OR")
    {
      res += 1ULL << (i+1);
    }
  }

  std::cout << res;
}