#include using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int L, R, M; cin >> L >> R >> M; int k = R - L + 1; cout << min(M, k) << "\n"; return 0; }