/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.07 15:48:36 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n;cin >> n; vector d; for (int i = 0; i < n; i++) { ll t;cin >> t; d.push_back(t); d.push_back(-t); } sort(d.begin(), d.end()); ll x,y;cin >> x >> y; x = abs(x) + abs(y); auto t = lower_bound(d.begin(), d.end(), x); if (t != d.end() && x == *t) { cout << 1 << endl; return 0; } for (int i = 0; i < d.size(); i++) { t = lower_bound(d.begin(), d.end(), x - d[i]); if (t != d.end() && x-d[i] == *t) { cout << 2 << endl; return 0; } } puts("-1"); return 0; }