import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long X = sc.nextLong(); long Y = sc.nextLong(); long Z = sc.nextLong(); long day = X <= Z ? Z-1 : Z; day = Y <= Z ? day-1 : day; println(day); } public static void print(Object o) { System.out.print(o); } public static void println(Object o) { System.out.println(o); } }