#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e6 + 7;
long long n, m;
int main() {
  cin >> n;
  long long l = 0, r = sqrt(n);
  while (l < r) {
    long long mid = (l + r + 1) >> 1;
    long long rst = 2 * mid + mid * (mid - 1) / 2 * 3;
    if (rst <= n)
      l = mid;
    else
      r = mid - 1;
  }
  long long k = l;
  long long cnt = 2 * k + k * (k - 1) / 2 * 3;
  long long left = n - cnt;
  k -= left % 3;
  if (n < 2 || k < 1) {
    puts("0");
    return 0;
  }
  long long rst = 1 + (k - 1) / 3;
  cout << rst << endl;
  return 0;
}
