N = int(input()) A = list(map(int, input().split())) MOD = 10 ** 9 + 7 up, down = 0, 0 for a in A: if a > 50: up += 1 elif a < 50: down += 1 if down: print((pow(2, up - 1, MOD) * pow(2, down, MOD)) % MOD) else: print(0)