    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P = pair<ll,ll>;
    const int INF=1001001001;
    const int mod=1e9+7;
    
    ll dp[100][100];
    int main() {
      int N;
      cin>>N;
      vector<string>s(N);
      rep(i,N){cin>>s[i];}
      dp[0][0]=1;
      dp[0][1]=1;
      rep(i,N){
        if(s[i]=="AND"){
          dp[i+1][1]+=dp[i][1];
          dp[i+1][0]+=dp[i][1]+2*dp[i][0];
        }
        else{
          dp[i+1][1]+=2*dp[i][1]+dp[i][0];
          dp[i+1][0]+=dp[i][0];
        }
      }
      cout<<dp[N][1]<<endl;
      return 0;
    }
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 5;
#define endl '\n'
#define ld long double
#define int ll
#define all(x)  (x).begin(),(x).end()

int32_t main(){
 
  IOS



	int n;
	cin >> n;
	vector<int> a(n), pref(n + 1, 0);
	vector<vector<int> > dp(n + 1, vector<int>(n + 1, 0)), sum(n + 2, vector<int>(n + 2, 0));

	for(int i = 0; i < n;i++) cin >> a[i], pref[i + 1] = pref[i] + a[i];

	dp[0][0] = 1;
	sum[1][0] = 1;
	for(int i = 1;i <= n;i++){
		for(int k = 1;k<=i;k++){
			int x = pref[i]%k;
			dp[i][k] += sum[k][x];
			dp[i][k]%=mod;
		}

		for(int k = 1;k<=n + 1;k++){
			sum[k][pref[i]%(k)] += dp[i][k - 1];
			sum[k][pref[i]%k]%=mod;
		}
	}

	int ans = 0 ;
	for(int i = 1;i<=n;i++){
		ans += dp[n][i];
		ans%=mod;
	}

	cout << ans << endl;
  




    
}  