N = int(input()) P = list(map(int,input().split())) P = [p for p in P if p != 50] MOD = 10**9+7 dp = [1,0] for p in P: ndp = [0,0] if p > 50: ndp = [dp[0]+dp[1],dp[1]+dp[0]] else: ndp = [dp[0]*2,dp[1]*2] dp = [ndp[0]%MOD,ndp[1]%MOD] print(dp[1])