#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if (c <= b) {
    printf("%d\n", c);
  } else if (c > b && c <= a) {
    printf("%d\n", b);
  } else {
    printf("%d\n", (b + a - c));
  }
  return 0;
}
