import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int s = sc.nextInt(); int sum = 0; if(Math.abs(a-s) < Math.abs(b-s)){ // aの方が近い sum += Math.abs(a-s) + s; }else{ // bの方が近い sum += Math.abs(b-s) + Math.abs(s-a) + a; if(a == 0) { sum++; } } System.out.println(sum); } }