#include <bits/stdc++.h>
using namespace std;
long long n, cnt;
int main(void) {
  cin >> n;
  long long t = 0;
  long long sq = (long long)sqrt(n);
  for (long long i = 1; i <= sq; ++i) {
    long long d = 2 * i + (i * i - i) * 3 / 2 - n;
    if (d >= 0) {
      if (d == 0) ++cnt;
      t = i;
      break;
    }
  }
  --t;
  for (long long i = 1; i <= t; ++i) {
    long long d = n - 2 * i + (i * i - i) * 3 / 2;
    if (d % 3 == 0) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}
