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