#include "bits/stdc++.h" #define in std::cin #define out std::cout #define rep(i,N) for(LL i=0;i<N;++i) typedef long long int LL; int main() { LL L, R, M; in >> L >> R >> M; out << std::min(R - L + 1, M) << std::endl; }