#include <bits/stdc++.h>
long long x, n, c;
bool isSum(long long x) { return x % 3 == 0; }
int main() {
  scanf("%I64d", &x);
  for (long long i = 1; i * (3 * i + 1) / 2 <= x; ++i) {
    c += isSum(x - i * (3 * i + 1) / 2);
  }
  printf("%I64d", c);
  return 0;
}
