#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = LLONG_MAX;
const long long ninf = LLONG_MIN;
const double eps = 1e-10;
const long long N = 1000005;
const long long LOGN = log2(N);
long long n;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  long long sum = 0;
  long long ans = 0;
  for (long long i = 1; i < N * 2; i++) {
    sum += 3 * i - 1;
    if (sum > n) break;
    if ((n - sum) % 3 == 0) ans++;
  }
  cout << ans << "\n";
  return 0;
}
