#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, h = 0, sol = 0;
  scanf("%I64d", &n);
  while (++h) {
    long long int r = 3 * h * (h + 1) / 2 - h;
    if (r > n) break;
    if ((n - r) % 3 == 0) sol++;
  }
  printf("%I64d\n", sol);
  return 0;
}
