#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long n, m, t = 0, ans = 0;
int main() {
  cin >> n;
  if (n % 3 == 0)
    t = 3;
  else if (n % 3 == 1)
    t = 2;
  else
    t = 1;
  for (long long i = t;; i = i + 3) {
    long long temp = i * (3 * i + 1) / 2;
    if (n >= temp)
      ans++;
    else
      break;
  }
  printf("%lld\n", ans);
  return 0;
}
