#include <bits/stdc++.h>
int main() {
  int64_t n;
  scanf("%lld", &n);
  int res = 0;
  for (int i = 1; i <= 1000000; ++i)
    if ((int64_t)i * (i + 1) + (int64_t)i * (i - 1) / 2LL <= n)
      res += (int)((n + i) % 3 == 0);
    else
      break;
  printf("%d\n", res);
  return 0;
}
