#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long ans = 0;
  long long sum = 0, prod = 0;
  long long i = 0;
  while (1) {
    sum += 2;
    prod += i;
    if (sum + 3 * prod > n) break;
    if ((n - sum + 3 * prod) % 3 == 0) ans++;
    i++;
  }
  cout << ans << "\n";
  return 0;
}
