#include <bits/stdc++.h>
using namespace std;
template <class t>
t gcd(t a, t b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <class t>
t lcm(t a, t b) {
  return a * b / gcd(a, b);
}
template <class t>
t absolute(t a) {
  if (a > 0)
    return a;
  else
    return -a;
}
inline long long power(long long base, long long p) {
  long long ans = 1;
  while (p > 0) ans *= base, p -= 1;
  return ans;
}
int main() {
  long long n;
  cin >> n;
  long long room, cardno = 2;
  int count = 0;
  for (long long f = 1; cardno <= n; f++) {
    room = (f * (f + 1)) / 2;
    cardno = f * 2 + (room - f) * 3;
    if (cardno <= n && (n - f * 2) % 3 == 0) count++;
  }
  cout << count << endl;
  return 0;
}
