#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  ll n;
  cin >> n;
  ll fmax = 0;
  for (ll f = 0; f < sqrt(n); f += 1) {
    if ((3 * f * (f + 1) / 2 - f) <= n && ((n + f) % 3) == 0)
      fmax = max(fmax, f);
  }
  cout << (fmax + 3 - 1) / 3 << endl;
  return 0;
}
