N = int(input()) P = list(map(int,input().split())) dp = [[0] * 2 for _ in range(N + 1)] mod = 10 ** 9 + 7 dp[0][0] = 1 import sys l = [] for p in P: if p != 50: l.append(p) N = len(l) dp = [[0] * 2 for _ in range(N+1)] for i in range(1,N+1): if P[i-1] > 50: dp[i][1] = dp[i-1][0] + dp[i-1][1] dp[i][0] = dp[i-1][1] + dp[i-1][0] elif P[i-1] == 50: dp[i][0] = dp[i-1][0] * 2 dp[i][1] = dp[i-1][1] * 2 else: dp[i][1] = dp[i-1][1] * 2 dp[i][0] = dp[i-1][0] * 2 dp[i][0] %= mod dp[i][1] %= mod print(dp[-1][1])