program SPIRAL710(input, output);
var N, I, J, K: word; 
    M, RESULT: longword;
function MIN4(A1, A2, A3, A4: word): word;
begin
    if (A1 > A2) then A1 := A2;
    if (A3 > A4) then A3 := A4;
    if (A1 > A3) then MIN4 := A3 else MIN4 := A1
end;
 
begin
    readln(N);
    readln(I);
    read(J);
    K := MIN4(I, J, (N+1-I), (N+1-J));
    M := 4 * (K - 1) * (N - K + 1);
    if (K = J) then RESULT := M + I - K
    else if (N + 1 - I) = K then RESULT := M + N + J - 3 * K + 1
    else if (N + 1 - J) = K then RESULT := M + 3 * N - I - 5 * K + 3
    else RESULT := M + 4 * N - J - 7 * K + 4;
    write(RESULT)
end.
