#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long kmin = 3 - n % 3;
  long long d = sqrt(1 + 24 * n);
  long long kmax = (-1 + d) / 6;
  cout << (kmax - kmin + 3) / 3;
}
