#include <bits/stdc++.h>
using namespace std;
const long long N = 100000;
const long long inf = (long long)1e9;
const long long MOD = (long long)1e9 + 7;
const long double eps = 1e-6;
const long long ABC = 26;
const long long P = 239;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  long long n;
  cin >> n;
  long long cnt = 0;
  for (long long i = 1; i <= 2000000; i++) {
    long long x = n + i;
    if (x % 3 != 0)
      continue;
    else
      x /= 3;
    if (i * (i + 1) / 2 <= x) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
