import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.math; // math functions void main() { auto n = readln.chomp.to!int; auto d = readln.split.to!(int[]); auto rd = readln.split.to!(int[]), x = rd[0].abs, y = rd[1].abs, d1 = x + y; auto ds = d.sort(); if (ds.contains(d1)) { writeln(1); return; } foreach (di; d) { auto d2 = (d1 - di).abs; if (ds.contains(d2)) { writeln(2); return; } } writeln(-1); }