#include <bits/stdc++.h>
using namespace std;
bool works(long long n, long long N) { return (n >= (N * (3 * N + 1) / 2)); }
int bsearch(long long n, int low, int high) {
  if (low == high) return low;
  if ((low + 1) == high) {
    if (works(n, high)) return high;
    return low;
  }
  int mid = (low + high) / 2;
  if (!works(n, mid))
    return bsearch(n, low, mid);
  else
    return bsearch(n, mid, high);
}
int main() {
  long long n;
  cin >> n;
  long long N = bsearch(n, 0, 1000000);
  int first = 1;
  while ((n + first) % 3) first++;
  if (first > N)
    cout << 0 << endl;
  else
    cout << ((N - first) / 3) + 1 << endl;
}
