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 min=0; int Amove=Math.abs(A-S); int Bmove=Math.abs(B-S); if(S==1){ min=Amove+1; }else{ if(Amove<=Bmove){ min=Amove+S; }else{ if(A==0){ min=Bmove+S+1; }else if(A