#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
long long n, ans = 0, t, a[maxn];
int main() {
  for (long long i = 1; i < maxn; i++) {
    a[i] = (i * i * 3LL + i) / 2LL;
  }
  scanf("%I64d", &n);
  long long cnt = 0, m = n;
  while (m > 0) {
    m -= 2;
    cnt++;
    if (m % 3 == 0) break;
  }
  if (cnt == 1 && n < 2)
    printf("0\n");
  else if (cnt == 2 && n < 7) {
    printf("0\n");
  } else if (cnt == 3 && n < 15)
    printf("0\n");
  else {
    for (int i = cnt;; i += 3) {
      if (a[i] > n) {
        break;
      }
      ans++;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
