using System;
using System.Linq;
using System.Collections.Generic;

public class Program
{
    static void Main()
    {
        string s = Console.ReadLine();
        int N = int.Parse(s);

        s = Console.ReadLine();
        var t = s.Split(' ');
        var D = new List<long>[2];
        D[0] = new List<long>();
        D[1] = new List<long>();
        for (int i = 0; i < N; ++i) {
            var d = long.Parse(t[i]);
            D[d%2].Add(d);
        }
         
        D[0].Sort();
        D[1].Sort();

        s = Console.ReadLine();
        t = s.Split(' ');

        long x = long.Parse(t[0]);
        long y = long.Parse(t[1]);
        long M = Math.Abs(x) + Math.Abs(y);

        if (x == 0 && y == 0) {
            Console.WriteLine(-1);
            return;
        }

        if (D[0].Contains(M) || D[1].Contains(M)) {
            Console.WriteLine(1);
            return;
        } 

        for (int m2 = 0; m2 < 2; ++m2) {
            for (int i = 0; i < D[m2].Count; ++i) {
                int j = m2 ^ (int)(M%2);
                int hi = D[j].Count;
                int lo = 0;
                while (hi - lo > 1) {
                    int mid = (hi + lo) / 2;
                    if (D[j][mid] - D[m2][i] <= M) {
                        lo = mid;
                    } else {
                        hi = mid;
                    }
                }

                if (j < D[j].Count && D[j][lo] - D[m2][i] <= M && M <= D[j][lo] + D[m2][i]) {
                    Console.WriteLine(2);
                    return;
                }
            }
        }

        Console.WriteLine(-1);
        
    }
}