#include <bits/stdc++.h>
using namespace std;
int mod1 = int(1e9) + 7;
int main() {
  long long n;
  cin >> n;
  long long sum = 0;
  for (long long i = 1; i <= 1000000LL; i++) {
    long long nn = n - i * 2 - 3 * (i - 1) * i / 2;
    if (nn >= 0 && nn % 3 == 0) sum++;
  }
  cout << sum << endl;
  return 0;
}
