import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const arr = input.split(/[ \n]/); let X = BigInt(arr[0]); let Y = BigInt(arr[1]); let Z = BigInt(arr[2]); if (Y <= Z) { console.log(Z - BigInt(2)); } else if (X <= Z && Z < Y) { console.log(Z - BigInt(1)); } else if (Z < X) { console.log(Z); }