#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int maxn = (int)2e6 + 11;
long long n;
long long a[maxn];
long long sum[maxn];
int main() {
  cin >> n;
  a[1] = 2;
  sum[1] = 2;
  for (int i = 2; i <= 2000000; i++) {
    a[i] = a[i - 1] + 3;
    sum[i] = sum[i - 1] + a[i];
  }
  int ans = 0;
  for (int i = 1; sum[i] <= n; i++) {
    if ((n - sum[i]) % 3 == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
