#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair #define pll pair const int inf = 1000000001; const ll INF = 1e18 * 2; #define MOD 1000000007 #define mod 1000000009 #define pi 3.14159265358979323846 #define Sp(p) cout<> n; vi d(n); for (i = 0; i < n; i++) { cin >> d[i]; } sort(d.begin(), d.end()); reverse(d.begin(), d.end()); int x, y; cin >> x >> y; x = abs(x); y = abs(y); if (x == 0 && y == 0) { cout << 0 << endl; return 0; } for (i = 0; i < n; i++) { if (x + y == d[i]) { cout << 1 << endl; return 0; } } if ((x + y) % 2 == 0) { if (x + y <= 2 * d[0]) { cout << 2 << endl; return 0; } else { cout << -1 << endl; return 0; } } else { int d1 = d[0], d2 = -1; for (i = 1; i < n; i++) { if (d1 % 2 != d[i] % 2) { d2 = d[i]; break; } } if (d2 == -1) { cout << -1 << endl; return 0; } if (x + y <= d1 + d2) { cout << 2 << endl; return 0; } else { cout << -1 << endl; return 0; } } }