program zad1;
var
  n,x1,x2,y1,y2:integer;
begin
  Read(x1);
  ReadLn(y1);
  Read(x2);
  ReadLn(y2);
  if ((x1 = x2) or (y1 = y2)) then n := 2
  else if (x2-x1 = y2-y1) then n := 1
  else n := 0;
  Write(n);
  ReadLn();
end.