program zirgo_kelias;
  { 47 u‘davinys }

  procedure zirgas (Ax, Ay, Bx, By: integer; { ‘irg— koordinat‚s }
                    var kiek: integer { ‚jim— skai‡ius });
    const lent: array [0..4, 0..4] of integer = ((0, 3, 2, 3, 2),
          { rankomis apskai‡iuotoji lentel‚ }    (3, 2, 1, 2, 3),
                                                 (2, 1, 4, 3, 2),
                                                 (3, 2, 3, 2, 3),
                                                 (2, 3, 2, 3, 4));
    var dx, dy: integer;  { koordina‡i— skirtumai }
  begin
    dx := abs (Ax - Bx);
    dy := abs (Ay - By);
    kiek := 0;
    while (dx > 4) or (dy > 4) do   { einame ma‘indami dviem vienetais }
      begin                         { didesni…j… koordinatŠ }
        if dx > dy
           then begin
                  dx := dx - 2;
                  dy := abs (dy - 1)
                end
           else begin
                  dy := dy - 2;
                  dx := abs (dx - 1)
                end;
        kiek := kiek + 1
      end;
    kiek := kiek + lent[dx, dy] { baigiame prisumuodami iž lentel‚s }
  end;

  var Ax, Ay, Bx, By: integer;
      kiek: integer;
begin
  readln (Ax, Ay, Bx, By);
  zirgas (Ax, Ay, Bx, By, kiek);
  writeln (kiek)
end.

