#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int h, n, m, a, t, i;
  cin >> n;
  h = (-1 + sqrt(1 + 24 * n)) / 6;
  for (i = h; i; i--) {
    m = i * (3 * i + 1) / 2;
    if (n - m >= 0 && (n - m) % 3 == 0) break;
  }
  cout << ++ ++i / 3 << endl;
  return 0;
}
