#include <iostream>
using namespace std;
int main () {
    int n1,n2,k;
    cin >> n1 >> n2 >> k;
if ( n1 > n2)
{
    if (k-n1 <= 0)
    {
        cout << 0;
    }
   else 
   {
       cout << k-n1;
   }
}
else 
{
    cout << k;
}
return 0;
}
