#include using namespace std; using ll = long long; const ll mod = 1e9 + 7; const ll inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; int l, r, m; int main() { cin >> l >> r >> m; cout << min(r + 1 - l, m) << endl; }