#include <bits/stdc++.h>
using namespace std;
int n, m, k, l, r;
int rd() {
  int re = 0, f = 1;
  char c = getchar();
  while ((c < '0') || (c > '9')) {
    if (c == '-') f = -f;
    c = getchar();
  }
  while ((c >= '0') && (c <= '9')) {
    re = re * 10 + c - '0';
    c = getchar();
  }
  return re * f;
}
int main() {
  cin >> m >> k;
  cin >> n;
  l = (n > k) ? (n - k) : 0;
  r = (m < n) ? m : n;
  cout << (r - l + 1) << '\n';
  return 0;
}
