#include #define rep(i,n) for(long long i=0;i<(n);++i) using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll L, R, M; cin >> L >> R >> M; if (R - L + 1 >= M) cout << M << endl; else cout << R - L + 1 << endl; }