#include int main() { int l, r, m; scanf("%d %d %d", &l, &r, &m); if (r - l + 1 < m) printf("%d\n", r - l + 1); else printf("%d\n", m); return 0; }