#include <bits/stdc++.h>
using namespace std;
long long int n, c = 0, k = 2, h = 2;
int main() {
  cin >> n;
  while (k <= n) {
    long long int s = n - k;
    if (s % 3 == 0) c++;
    h += 3;
    k += h;
  }
  cout << c << endl;
  return 0;
}
