using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var d = NList; var c = NList; var x = (long)Math.Abs(c[0]) + Math.Abs(c[1]); var emax = -1; var omax = -1; if (x == 0) { WriteLine(0); return; } foreach (var di in d) { if (x == di) { WriteLine(1); return; } if (di % 2 == 0) emax = Math.Max(emax, di); else omax = Math.Max(omax, di); } var e2max = -1; var o2max = -1; if (emax > 0) e2max = Math.Max(e2max, emax * 2); if (omax > 0) e2max = Math.Max(e2max, omax * 2); if (emax > 0 && omax > 0) o2max = emax + omax; if (x % 2 == 0) WriteLine(x <= e2max ? 2 : -1); else WriteLine(x <= o2max ? 2 : -1); } }