#include using namespace std; int L,R,M; int main(){ cin >> L >> R >> M; cout << ((R-L+1>=M)? R-L+1:M) << endl; }