#include <bits/stdc++.h>
using namespace std;
long long n, ans;
int main() {
  scanf("%I64d", &n);
  for (long long h = 1; (1 + h) * h / 2 * 3 <= n + h; h++)
    if ((n + h) % 3 == 0) ans++;
  printf("%I64d\n", ans);
}
