#include using namespace std; int main() { int L, R, M; cin >> L >> R >> M; int ans = min( M, R - L + 1 ); cout << ans << endl; }