#include <bits/stdc++.h>
using namespace std;

int main() {
  long long n;
  cin >> n;
  vector<bool> s(n);
  for(int i = 0; i < n; i++){
    string now;
    cin >> now;
    if(now == "AND") s.at(i) = true;
    else s.at(i) = false;
  }
  
  long long ans = 1;
  reverse(s.begin(), s.end());
  for(long long i = 0; i < n; i++){
    if(s.at(i)) continue;
    long long sum = 1;
    for(int j = 0; j < n-i; j++) sum *= 2;
    ans += sum;
  }
  
  cout << ans << endl;
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    n=1<<n;
    ll left=0,right=0;
    map<ll,ll>mp;
    ll a[n+1];
    for(ll i=1; i<=n; i++)
    {
        cin>>a[i];
        mp[a[i]]=i;
    }
    for(ll i=1; i<=n; i++)
    {
        if(i<=n/2)
            left=max(left,a[i]);
        else
            right=max(right,a[i]);
    }
    if(left<right)
        cout<<mp[left]<<endl;
    else
        cout<<mp[right]<<endl;
}
