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