import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } void run() { Scanner sc = new Scanner(System.in); int A=sc.nextInt(); int B=sc.nextInt(); int S=sc.nextInt(); if(Math.abs(S-A)<=Math.abs(S-B)) { System.out.println(Math.abs(S-A)+Math.abs(S-0)); }else { if(A>0) { System.out.println(Math.abs(S-B)+Math.abs(A-B)+Math.abs(A)); }else { System.out.println(Math.abs(S-B)+Math.abs(S-1)+2); } } } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }