#include <bits/stdc++.h>
using namespace std;
int main() {
  double n;
  scanf("%lf", &n);
  long long int max_height = (long long int)(sqrtf(24 * n + 1) - 1) / 6;
  long long int m = (long long int)n;
  if ((m + 1) % 3 == 0) printf("%lld\n", (max_height + 2) / 3);
  if ((m + 2) % 3 == 0) printf("%lld\n", (max_height + 1) / 3);
  if (m % 3 == 0) printf("%lld\n", max_height / 3);
  return 0;
}
