#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, s;
  long a;
  while (cin >> n >> k >> s) {
    if (n == 0 && k == 0 && s == 0) break;
    int h[k], t = 0;
    h[0] = 0;
    for (int i = 0; i < k - 1; i++) {
      h[k - 1 - i] = n - i;
      t = t + n - i;
    }
    int ct = 0;
    do {
      if (s - t < h[1] && s - t > 0) {
        ct++;
      }
      for (int i = 0; i < k - 1; i++) {
        if (h[i + 1] - h[i] > 1) {
          h[i + 1]--;
          break;
        } else if (h[i + 1] - h[i] == 1 && h[i + 2] - h[i + 1] > 1) {
          h[i + 2]--;
          for (int j = 0; j < i + 1; j++) {
            h[i + 1 - j] = h[i + 2 - j] - 1;
          }
          break;
        }
      }
      t = 0;
      for (int i = 0; i < k - 1; i++) {
        t = t + h[i + 1];
      }
    } while (t > (k - 1) * k / 2);
    cout << ct << endl;
  }
  return 0;
}
