#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, floors, addend, val;
  cin >> n;
  floors = 0;
  addend = 2;
  val = 2;
  while (val <= n) {
    floors++;
    addend += 3;
    val += addend;
  }
  if (floors % 3 == 0) {
    if (n % 3 == 1) {
      floors -= 1;
    }
    if (n % 3 == 2) {
      floors -= 2;
    }
  }
  if (floors % 3 == 1) {
    if (n % 3 == 0) {
      floors -= 1;
    }
    if (n % 3 == 1) {
      floors -= 2;
    }
  }
  if (floors % 3 == 2) {
    if (n % 3 == 2) {
      floors -= 1;
    }
    if (n % 3 == 0) {
      floors -= 2;
    }
  }
  cout << (floors + 2) / 3 << endl;
}
