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