#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second
 
using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e8;
const ll MOD = 1000000007;
 
ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}
ll LCM(ll x, ll y){
	return x/GCD(x, y)*y;
}

int main() {
	int n; cin >> n;
	string s[100];
	rep(i, 0, n) cin >> s[i];
	ll ans = 1;
	for(int i=n-1;i>=0;i--){
		if(s[i]=="AND"){
			continue;
		}else{
			ll addans = 1;
			rep(j, 0, i+1){
				addans *= 2;
			}
			ans += addans;
		}
	}
	cout << ans << endl;
    return 0;
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define tf(x) get<0>(x)
#define ts(x) get<1>(x)
#define tt(x) get<2>(x)
#define endl '\n'
#define F first
#define S second 
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define tup tuple<int,int,int>
#define ve vector <int>
#define vep vector<pii >
#define mod 1000000007
#define maxn 2e5+5
#define ld long double
#define mem(x) memset(x,0,sizeof(x))
#define in insert
#define fr(i,a,b) for(int i=a;i<b;i++)
#define forn(i,n) for(int i=0;i<n;i++)
#define fora(m) for(auto it:m)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define input_array int n;cin>>n;int a[n];forn(i,n) cin>>a[i];
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 


int mull(int  a,int b)  { 
    return ((a%mod)*(b%mod))%mod;
} 

int power(int x, int y, int p) 
{ 
    int res = 1;     
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
int modInverse(int n, int p) 
{ 
    return power(n, p-2, p); 
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};

//--------------------------------SIEVE---------------------------//
/*bool prime[maxn]; 
int spf[maxn];
void sieve() {
	forn(i,maxn) {
		prime[i]=true;
		spf[i]=i;
	}
	fr(i,2,maxn) {
		if(prime[i]){
			for(int j=2*i;j<maxn;j+=i) {
				prime[j]=false;
				spf[j]=i;
			}
		}
	}
}*/

//-----------------------------End---------------------------------//


//------------------------------------------------DFS------------------------//
/*bool stat[maxn];
int depth[maxn],par[maxn];
void init_graph() {
	memset(stat,false,sizeof(stat);
	memset(depth,0,sizeof(depth);
	for(int i=0;i<maxn;i++) par[i]=i;
}
void dfs(int u,int p) {
	stat[u]=true;
	depth[u]=depth[p]+1;
	par[u]=p;
	for(auto it:g[u]) {
		if(stat[it]==false)
			dfs(it,u);
	}
}*/

//-------------------------------------DFS-END--------------------------------//

//-----------------------------------nCr%p-----------------------------------//
/*int nCr(int n, int r) 
{ 
   if (r==0) 
      return 1; 
    int fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%mod; 
  
    return (fac[n]* modInverse(fac[r], mod) % mod * 
            modInverse(fac[n-r], mod) % mod) % mod; 
} */
//---------------------------------EnD---------------------------------------//

void solve() {
    int n;
    cin>>n;
    int a[n+1];
    fr(i,1,n+1) cin>>a[i];
    int dp[n+1][n+1],pre[n+1][n+1];
    mem(dp);
    memset(pre,-1,sizeof(pre));
    for(int i=1;i<=n;i++) pre[i][0] = 0;
    dp[1][1] = 1;
    // pre[1][0] = 1;
    int sum = a[1];
    for(int i=1;i<=n;i++) pre[i][sum%i] = 1;
    for(int i=2;i<=n;i++) {
        sum+=a[i];
        for(int j=1;j<=n;j++) {
            int mo = sum%j;
            if(pre[j][mo]==-1) {
                pre[j][mo] = i;
                continue;
            }
            // if(pre[j][mo]==0) {
            //     dp[i][j] = (dp[i-1][j-1] + dp[i-1][j])%mod;
            //     pre[j][mo] = i;
            //     continue;
            // }
            dp[i][j] = (dp[pre[j][mo]][j-1] + dp[pre[j][mo]][j])%mod;
            pre[j][mo] = i;
            // cout<<dp[i][j]<<" ";
        }
        // cout<<endl;
    }
    // for(int i=1;i<=n;i++) {
    //     for(int j=1;j<=i;j++) cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    int ans= 0;
    for(int i=1;i<=n;i++) ans = (ans+dp[n][i])%mod;
    cout<<ans;
}
signed main() {
	IOS
	int t=1;
	// cin>>t;
	while(t--) {
		solve();
	}
	return 0;
} 