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