#include <stdio.h>

int main() {
  int l, r, m, ans;
  scanf("%d %d %d", &l, &r, &m);

  ans = r-l+1;
  printf("%d", ans<m ? ans: m);
  return 0;
}