#include <bits/stdc++.h>
using namespace std;
long long fun(long long k) { return 3 * k * k + k; }
int main() {
  long long n, dist = 0;
  cin >> n;
  long long first = 3 - (n % 3);
  long double radical = sqrtl(1 + 24 * n) - 1;
  radical /= 6;
  long long maxk = (long long)radical;
  long long diff = maxk - first;
  dist = (diff / 3) + 1;
  if (maxk >= first)
    cout << dist << endl;
  else
    cout << 0 << endl;
  return 0;
}
