#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  long long ans = 0;
  long long least = sqrt(2 * N / 3.0) + 1;
  for (int i = 1; i <= least; i++) {
    long long k = (N + i);
    if (k % 3) continue;
    if (1LL * (1 + i) * i / 2 <= k / 3) ans++;
  }
  cout << ans << endl;
}
