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