#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, ans = 0, a, b = 0, N;
  cin >> N;
  for (long long i = 1; i <= 1e6; i++) {
    n = N;
    a = i * 2;
    n -= a;
    b = ((i - 1) * (i * 3) / 2);
    n -= b;
    if (n < 0) break;
    if (n % 3 == 0) ans++;
  }
  cout << ans;
  return 0;
}
