#include <bits/stdc++.h>
int main() {
  long long n;
  scanf("%lld", &n);
  long long maxi = sqrt(n);
  int is = 0;
  for (long long i = maxi; i >= 1; i--) {
    if ((3 * i * i + i) / 2 <= n && (n - (3 * i * i + i) / 2) % 3 == 0) {
      is++;
    }
  }
  printf("%d", is);
}
