#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; int main(){ int l,r,m; cin >> l >> r >> m; cout << min(r-l+1,m) << endl; return 0; }