#include <bits/stdc++.h>
int main() {
  long long n, m, i, j, k, a, b, c, t;
  scanf("%lld", &n);
  for (i = 0; (i * (3 * i + 1)) / 2 <= n; ++i)
    ;
  i--;
  if (n % 3 == 0) j = i / 3;
  if (n % 3 == 1) j = (i + 1) / 3;
  if (n % 3 == 2) j = (i + 2) / 3;
  printf("%lld\n", j);
  return 0;
}
