import sys n = int(input()) d_arr = list(map(int, input().split())) d_even = [] d_odd = [] for d in d_arr: if d % 2 == 0: d_even.append(d) else: d_odd.append(d) x, y = map(lambda n: abs(int(n)), input().split()) if x == 0 and y == 0: print(0) sys.exit() for d in d_arr: if d == x + y: print(1) sys.exit() if len(d_even) >= 2: d_even_max = max(d_even) d_even.remove(d_even_max) d_even_second_max = max(d_even) if x + y - d_even_max < d_even_second_max: print(2) sys.exit() if len(d_odd) >= 2: d_odd_max = max(d_odd) d_odd.remove(d_odd_max) d_odd_second_max = max(d_odd) if x + y - d_odd_max < d_odd_second_max: print(2) sys.exit() print(-1)