N = int(input()) P = list(map(int,input().split())) MOD = 10**9+7 dp = [1,0] for i,p in enumerate(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])