an=int(input()) xs=[int(x) for x in input().split()] dx,dy=[int(x) for x in input().split()] o=-1 e=-1 for x in xs: if x %2==0: e=max(e,x) else: o=max(o,x) dx=abs(dx) dy=abs(dy) s=dx+dy if (s==0): print(0) elif s%2==1: if s <= o: print(1) else: print(2 if s<=o+e else -1) else: if s <= e : print(1) else : print(2 if s <=max(o+o,e+e) else -1)