#include using namespace std; const int MAX = 1e5 + 10; int n; long long d[MAX]; long long x, y; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lld", d + i); } scanf("%lld%lld", &x, &y); sort(d, d + n); if (x == 0 && y == 0) { cout << 0 << endl; return 0; } x = llabs(x); y = llabs(y); for (int i = 0; i < n; i++) { if (d[i] == x + y) { cout << 1 << endl; return 0; } } vector vv[2]; for (int i = 0; i < n; i++) { vv[d[i] % 2].emplace_back(d[i]); } // if (d[i] + d[j] >= x + y && (d[i] + d[j] - (x + y)) % 2 == 0) ok? for (int i = 0; i < n; i++) { if (d[i] + vv[d[i] % 2].back() >= x + y && (d[i] + vv[d[i] % 2].back() - (x + y)) % 2 == 0) { cout << 2 << endl; return 0; } } cout << -1 << endl; }