void main(){ import std.stdio, std.string, std.conv, std.algorithm; import std.math, std.range; int n; rd(n); auto d=readln.split.to!(int[]); int x, y; rd(x, y); if(x==0 && y==0){writeln(0); return;} auto d0=x.abs+y.abs; if(count(d, d0)){writeln(1); return;} sort(d); auto p=assumeSorted(d); foreach(i; 0..n){ if(p.canFind(d0-d[i])){writeln(2); return;} if(p.canFind(d0+d[i])){writeln(2); return;} if(p.canFind(d[i]-d0)){writeln(2); return;} } writeln(-1); } void rd(T...)(ref T x){ import std.stdio, std.string, std.conv; auto l=readln.split; assert(l.length==x.length); foreach(i, ref e; x){ e=l[i].to!(typeof(e)); } }