#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long now = 2, add = 5, an = 0;
  for (; now <= n;) {
    if ((n - now) % 3 == 0) an++;
    now += add;
    add += 3;
  }
  cout << an << endl;
  return 0;
}
