#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long long max_h;
  cin >> n;
  long long left = 0, right = 1000000 + 1;
  while (right - left > 1) {
    long long m = (left + right) / 2;
    if (3 * m * m + m <= 2 * n)
      left = m;
    else
      right = m;
  }
  max_h = left;
  int ans = 0;
  for (int i = max_h; i >= 1; --i)
    if ((n + i) % 3 == 0) ++ans;
  cout << ans << endl;
  return 0;
}
