#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000");
using namespace std;
long long int CalMax(long long int x) {
  if (x % 3 == 0) {
    if (x < 15) return 0;
    long long int anw = 0, ans = 0, mod = 15;
    while (ans <= x) anw++, ans += mod, mod += 27;
    return --anw;
  }
  if (x % 3 == 2) {
    x -= 2;
    if (x < 24) return 1;
    long long int anw = 1, ans = 0, mod = 24;
    while (ans <= x) anw++, ans += mod, mod += 27;
    return --anw;
  }
  if (x % 3 == 1) {
    if (x < 7) return 0;
    long long int anw = 1, ans = 0, mod = 33;
    while (ans <= x) anw++, ans += mod, mod += 27;
    return --anw;
  }
}
int main() {
  long long int n;
  scanf("%I64d", &n);
  printf("%I64d\n", CalMax(n));
  return 0;
}
