#include <bits/stdc++.h>
using namespace std;
long long int getmax(long long int floors) {
  return 3 * floors * (floors + 1) / 2 - floors;
}
long long int fun(long long int n) {
  long long int res = 0;
  for (long long int floors = 1; getmax(floors) <= n; floors++)
    if ((n + floors) % 3 == 0) res++;
  return res;
}
int main() {
  long long int n;
  cin >> n;
  cout << fun(n);
}
