#include #include #include using namespace std; int main() { int n; cin >> n; vector d(n); for (int i = 0; i < n; i++) { cin >> d[i]; } int x, y; cin >> x >> y; if (x == 0 && y == 0) { cout << 0 << endl; return 0; } for (int i = 0; i < n; i++) { if (abs(x) + abs(y) == d[i]) { cout << 1 << endl; return 0; } } for (int i = 0; i < n; i++) { if (abs(x) + abs(y) <= 2 * d[i]) { cout << 2 << endl; return 0; } } cout << -1 << endl; }