#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  int res = 0;
  for (long long i = 1; i <= n; i++) {
    if ((n + i) % 3) continue;
    long long tmp = (n + i) / 3;
    if ((1 + i) * i / 2 <= tmp)
      res++;
    else
      break;
  }
  cout << res << endl;
  return 0;
}
