#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double PI = 2 * acos(0.0);
int main() {
  long long n;
  cin >> n;
  long long lvl = 2;
  long long q = 0;
  while (true) {
    q = (lvl + 1) * lvl + lvl * (lvl - 1) / 2;
    if (q > n) break;
    lvl++;
  }
  long long ans = 0;
  lvl--;
  n -= lvl * (lvl + 1);
  n -= lvl * (lvl - 1) / 2;
  if (n % 3) lvl--;
  if (n % 3 == 2) lvl--;
  cout << (lvl + 2) / 3 << endl;
}
