MOD = 10 ** 9 + 7 n = int(input()) dp0 = 1 dp1 = 0 for p in map(int, input().split()): ndp0 = dp0 ndp1 = dp1 if p < 50: ndp0 += dp0 ndp1 += dp1 elif p > 50: ndp0 += dp1 ndp1 += dp0 dp0, dp1 = ndp0, ndp1 dp0 %= MOD dp1 %= MOD ans = dp1 % MOD print(ans)