#include using namespace std; #define int long long signed main() { int N, D[100000], X, Y; cin >> N; for(int i = 0; i < N; i++) { cin >> D[i]; } cin >> X >> Y; if(X == 0 && Y == 0) { cout << 0 << endl; return (0); } int F = llabs(X) + llabs(Y); for(int i = 0; i < N; i++) { if(F == D[i]) { cout << 1 << endl; return (0); } } sort(D, D + N); for(int i = 0; i < N; i++) { int sa = F - D[i]; auto p = lower_bound(D, D + N, sa) - D; if(p == N) continue; if(D[p] == sa) { cout << 2 << endl; return (0); } } cout << -1 << endl; }