#include #define REP(i, n) for(int i=0;i<(n);++i) #define LL long long using namespace std; int main(void) { LL L, R, M; cin >> L >> R >> M; int ans = min(R-L+1, M); cout << ans << endl; }