#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long max_levels = 0;
  long long step = 2;
  for (long long current = 2; current <= n; current += step) {
    max_levels++;
    step += 3;
  }
  int start = 1;
  if (n % 3 == 1)
    start = 2;
  else if (n % 3 == 0)
    start = 3;
  cout << ((max_levels - start) / 3 + (max_levels >= start)) << endl;
  return 0;
}
