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