#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; ll n, x, y,d[100005]; int main(void){ cin >> n; ll Min = 1000000005, Max = -1; for (int i = 0; i < n; i++){ cin >> d[i]; Min = min(Min, d[i]); Max = max(Max, d[i]); } cin >> x >> y; x = max(x, -x); y = max(y, -y); for (int i = 0; i < n; i++){ if (x + y == d[i]){ cout << 1 << endl; return 0; } } if (x + y < Min * 2 || x + y > Max * 2) cout << -1 << endl; else cout << 2 << endl; }