#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w,
    x, y, z, aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, ll, mm, nn, oo, pp, qq,
    rr, ss, tt, uu, vv, ww, xx, yy, zz;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b >> c;
  if (c <= b)
    cout << c;
  else if (c > a)
    cout << a + b - c;
  else
    cout << b;
}
