#include <bits/stdc++.h>

#define  LL long long

const int maxn=1e5+5;
using namespace std;
LL ans=0;
int  op[80];
LL ans1[80];
LL ans2[80];
int main()
{
    LL n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        if(s=="AND")
            op[i]=1;
        else
            op[i]=0;
    }
    memset(ans1,0,sizeof(ans1));
    memset(ans2,0,sizeof(ans2));
    ans1[0]=1;
    ans2[0]=1;
    for(int i=1;i<=n;i++)
    {
        if(op[i]==1)  ///and
        {
            ans1[i]=ans1[i-1];
            ans2[i]=ans1[i-1]+ans2[i-1]*2;
        }
        else          ///or
        {
            ans1[i]=ans1[i-1]*2+ans2[i-1];
            ans2[i]=ans2[i-1];
        }
    }
    /*for(int i=0;i<=n;i++)
        cout<<ans1[i]<<" ";
    cout<<endl;
    for(int i=0;i<=n;i++)
        cout<<ans2[i]<<" ";
    cout<<endl;*/
    cout<<ans1[n]<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
int main() {
  int n;
  cin >> n;
  vector<ll> dp(2, 1);
  vector<ll> ndp(2, 0);
  rep(i,n) {
    string s;
    cin >> s;
    rep(xi,2) {
      rep(xi1,2) {
        int yi1;
        if (s == "AND") {
          yi1 = xi & xi1;
        } else {
          yi1 = xi | xi1;
        }
        ndp[yi1] += dp[xi];
      }
    }
    swap(ndp, dp);
    ndp.clear();
    ndp.resize(2);
  }
  ll ans = dp[1];
  cout << ans << endl;
  return 0;
}
