#include #include #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++) typedef long long int ll; int main( void ){ ll a, b, c; if (!scanf( "%lld %lld %lld", &a, &b, &c )) return 0; ll sum = c; if (c>=a) sum--; if (c>=b) sum--; if (sum < 0) sum = 0; printf("%lld\n", sum); return 0; }