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