//#define _GLIBCXX_DEBUG #include #include #include #include using namespace std; using namespace atcoder; using mint = modint1000000007; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using vb = vector; using vvb = vector; using vm = vector; using vvm = vector; using vpi = vector; using vvpi = vector; using vpl = vector; using vvpl = vector; const int inf = 1 << 30; const ll INF = 1LL << 60; #define rep(i,m,n) for (int i = m; i < (int)(n); i++) #define rrep(i,m,n) for (int i = m; i > (int)(n); i--) int main(){ int n; cin >> n; vi P(n); rep(i,0,n){ cin >> P[i]; } vvm dp(n+1,vm(2)); dp[0][0] = 1; rep(i,0,n){ dp[i+1][0] += dp[i][0]; dp[i+1][1] += dp[i][1]; if (P[i] < 50){ dp[i+1][1] += dp[i][1]; dp[i+1][0] += dp[i][0]; } else if (P[i] > 50){ dp[i+1][0] += dp[i][1]; dp[i+1][1] += dp[i][0]; } else{ dp[i+1][0] += dp[i][1] + dp[i][0]; } } cout << dp[n][1].val() << endl; }