#include <bits/stdc++.h>
using namespace std;
long long n;
long long say;
long long temp;
long long mertebe[1000000];
long long cem(long long x) { return x * (x + 1) / 2; }
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= 2000000; i++) {
    mertebe[i] = cem(i - 1) + cem(i) * 2;
    if (mertebe[i] > n) {
      break;
    }
  }
  for (int i = 1; i <= 2000000; i++) {
    if (mertebe[i] > n) {
      break;
    }
    temp = n - mertebe[i];
    if (temp % 3 == 0) {
      say++;
    }
  }
  cout << say << endl;
  return 0;
}
