#include <bits/stdc++.h>
using namespace std;
long long n;
bool judge(long long x) { return ((n + x) % 3) == 0; }
int main() {
  while (scanf("%I64d", &n) != EOF) {
    long long k = 1;
    while ((3 * k * (k + 1) - 2 * k) <= (2 * n)) {
      k++;
    }
    k--;
    long long ans = 0;
    for (long long i = 1; i <= k; ++i) {
      if (judge(i)) ans++;
    }
    printf("%I64d\n", ans);
  }
}
