#include <bits/stdc++.h>
int main(void) {
  std::cin.sync_with_stdio(false);
  std::cout.sync_with_stdio(false);
  long long num;
  std::cin >> num;
  long long sum = 2;
  long long factor = 1;
  long long heights = 0;
  if ((num - sum) % 3 == 0) ++heights;
  while (sum <= num) {
    const long long addon = 2 + factor * 3;
    sum += addon;
    ++factor;
    if (((num - sum) % 3 == 0) && (num - sum >= 0)) ++heights;
  }
  std::cout << heights << std::endl;
  return 0;
}
