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