program MyProgram;
uses Math, SysUtils;

var
    X1, X2, Y1, Y2, r : integer;

begin
    ReadLn(X1,Y1);
    ReadLn(X2,Y2);
    if X1 = X2 then
    begin
        r := 2 ;
    end
    else
    begin
        if Y1 = Y2 then
        begin
            r := 2;
        end
        else
        begin
            if X1 + Y1 = X2 + Y2 then
            begin
                r := 1;
            end
            else
            begin
                if X1 - Y1 = X2 - Y2 then
                begin
                    r := 1;
                end
                else
                begin
                    r := 0 ;
                end
            end
        end
    end;
    WriteLn(r);
end.