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