#include <bits/stdc++.h>
using namespace std;
long long int modpow(long long int a, long long int n, long long int temp) {
  long long int res = 1, y = a;
  while (n > 0) {
    if (n & 1) res = (res * y) % temp;
    y = (y * y) % temp;
    n /= 2;
  }
  return res % temp;
}
long long int arr[10000006];
int main() {
  long long int n, i, ans = 0, val;
  arr[1] = 2;
  for (i = 2; i < 10000000; ++i) {
    arr[i] = arr[i - 1] + 3 * i - 1;
    if (arr[i] >= 1000000000000) break;
  }
  scanf("%lld", &n);
  for (i = 1;; i++) {
    val = n - arr[i];
    if (val < 0) break;
    if (val % 3 == 0) ans++;
  }
  printf("%lld\n", ans);
  return 0;
}
