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