#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, temp;
  cin >> n;
  long long int h = 0;
  temp = 2 * n;
  long long int rem = n - h * (4 + (h - 1) * 3) / 2;
  long long int totalMax = 0;
  h = 1;
  while ((3 * h * h + h) <= temp) {
    rem = n - h * (4 + (h - 1) * 3) / 2;
    if (rem % 3 == 0) {
      totalMax++;
    }
    h++;
  }
  cout << totalMax << endl;
  return 0;
}
