#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  int hmax = 0;
  for (int p = 30; p >= 0; p--) {
    int nh = hmax + (1 << p);
    if ((n - 2LL * nh) / 3 >= 1LL * nh * (nh - 1) / 2) {
      hmax = nh;
    }
  }
  int ans = 0;
  for (int h = 1; h <= hmax; h++) {
    if ((n - 2 * h) % 3 == 0) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
