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