#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0, calc;
  cin >> n;
  for (long long i = 1;; i++) {
    calc = 3 * i * (i + 1) / 2 - i;
    if (calc <= n && (n - calc) % 3 == 0) ans++;
    if (calc > n) break;
  }
  cout << ans;
}
