#include using namespace std; typedef long long ll; typedef vector vl; typedef long double ld; typedef vector vd; typedef bool bl; typedef vector vb; typedef unordered_map> graph; const ll e5 = 1 << 20; const ll mod = 998244353; const ll e3 = 1 << 13; const ll INF = 1ll << 60; ll l,r,m; int main(){ cin >> l >> r >> m; cout << min(m,r-l+1) << endl; }