#include using namespace std; typedef long long int ll; ll MOD = 1000000007; ll INFL = 1ll << 60; ll INF = 1 << 28; // ==================================================================== int main() { ll l, r, m; cin >> l >> r >> m; cout << min(r - l + 1, m) << endl; }