#include <bits/stdc++.h>
const double EPS = 1e-24;
const long long mod = 1000000007ll;
const long long mod1 = 1000000009ll;
const long long mod2 = 1100000009ll;
const double PI = 3.14159265359;
int INF = 2147483645;
long long INFINF = (long long)1e15;
template <class T>
T Max2(T a, T b) {
  return a < b ? b : a;
}
template <class T>
T Min2(T a, T b) {
  return a < b ? a : b;
}
template <class T>
T Max3(T a, T b, T c) {
  return Max2(Max2(a, b), c);
}
template <class T>
T Min3(T a, T b, T c) {
  return Min2(Min2(a, b), c);
}
template <class T>
T Max4(T a, T b, T c, T d) {
  return Max2(Max2(a, b), Max2(c, d));
}
template <class T>
T Min4(T a, T b, T c, T d) {
  return Min2(Min2(a, b), Max2(c, d));
}
using namespace std;
long long bit_count(long long _x) {
  long long _ret = 0;
  while (_x) {
    if (_x % 2 == 1) _ret++;
    _x /= 2;
  }
  return _ret;
}
long long bit(long long _mask, long long _i) {
  return (_mask & (1 << _i)) == 0 ? 0 : 1;
}
long long powermod(long long _a, long long _b, long long _m) {
  long long _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a) % _m;
    _b /= 2;
    _a = (_a * _a) % _m;
  }
  return _r;
}
long long add(long long a, long long b, long long m) {
  long long first = a + b;
  while (first >= m) first -= m;
  return first;
}
long long sub(long long a, long long b, long long m) {
  long long first = a - b;
  while (first < 0) first += m;
  return first;
}
long long mul(long long a, long long b, long long m) {
  long long first = a * b;
  first %= m;
  return first;
}
long long operator*(pair<int, int> A, pair<int, int> B) {
  return A.first * B.second - A.second * B.first;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long k = (-1 + sqrt(1 + 24 * n)) / 6;
  int ans = 0;
  for (int i = 0; i < int(k); i++) {
    if ((i + 1 + n) % 3 == 0) ans++;
  }
  cout << ans;
}
