#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n;
  cin >> n;
  int h = 0;
  for (unsigned long long i = 1; i <= 1E6 + 5; ++i) {
    unsigned long long base = i * 2;
    unsigned long long m3_least = (i - 1) * i / 2;
    if (n < base) {
      break;
    }
    if ((n - base) % 3 != 0) {
      continue;
    }
    if ((n - base) / 3 < m3_least) {
      break;
    }
    ++h;
  }
  cout << h << endl;
}
