using System; using System.Linq; using System.Collections.Generic; using System.IO; class MyClass { public static void Solve() { var input = Console.ReadLine().Split().Select(long.Parse).ToArray(); var X = input[0]; var Y = input[1]; var Z = input[2]; Console.WriteLine(Z < X ? Z : Z < Y ? Z - 1 : Math.Max(Z - 2, 0)); } public static void Main() { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } }