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