#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  std::istream* in;
  in = &cin;
  long long k;
  *in >> k;
  long long res = 0;
  for (long long i = 1; i * (3 * i + 1) / 2 <= k; i++) {
    if ((k + i) % 3 == 0) res++;
  }
  cout << res << endl;
  return 0;
}
