#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  long long ans = 0;
  for (long long k = 1; 2 * k + 3 * k * (k - 1) / 2 <= n; k++) {
    if ((n - (2 * k + 3 * k * (k - 1) / 2)) % 3 == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
