#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
long long n;
int main() {
  cin >> n;
  long long first;
  for (first = 0; 3ll * first * (first + 1) / 2 - first <= n; first++) {
  }
  first--;
  while ((n + first) % 3) first--;
  cout << (first + 2) / 3 << endl;
  return 0;
}
