#include <bits/stdc++.h>
using namespace std;

int main(){
  int l,r,m;
  cin >> l >> r >> m;

  cout << min(r-l+1,m) << endl;
}