#include using namespace std; typedef unsigned long long ull; typedef long long ll; int main(){ ll l, r, m; cin >> l >> r >> m; cout << min(r-l+1, m) << endl; return 0; }