#include <bits/stdc++.h>
using namespace std;
long long n;
void precompute() {}
void read() { scanf("%lld", &n); }
void preprocess() {}
bool ok(long long num, long long parts) {
  return num >= (parts * (parts + 1) >> 1);
}
void solve() {
  int ans = 0;
  for (int h = 1;; ++h) {
    long long sum = n + h;
    if (sum % 3 != 0) continue;
    if (ok(sum / 3, h)) {
      ans++;
    } else
      break;
  }
  printf("%d\n", ans);
}
int main() {
  precompute();
  read();
  preprocess();
  solve();
  return 0;
}
