program Kvadrati;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };
  var x1, x2, y1, y2: longint;
begin
  read(x1, y1);
  read(x2, y2);
  if (x1=x2) or (y1=y2) then writeln('2')
  else
    begin
      if ABS(x1-x2)=ABS(y1-y2) then writeln('1')
      else writeln('0');
    end;
end.