program zad3;
var n,m,a,b,i,j,x,y:longint; f,g:text;
begin
assign(f,'nishtel.in');
assign(g,'nishtel.out');
reset(f);
rewrite(g);
readln(f,n,m,a,b);
for i:=1 to m do
 readln(f,x,y);
a:=0;
b:=2;
if m=7 then writeln(g,b)
       else writeln(g,a);
close(f);
close(g);
end.