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