#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  long long n;
  cin >> n;
  for (long long i = 1;; ++i) {
    if (((3LL * i * (i + 1)) / 2) - i > n) break;
    if ((n + i) % 3 == 0) ++ans;
  }
  cout << ans << "\n";
  return 0;
}
