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, MOD) * pow(2, down - 1, MOD)) % MOD) else: print(0)