#include <bits/stdc++.h>
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T>
inline void scand(T &x) {
  char c;
  x = 0;
  while ((c = getchar()) < '0')
    ;
  while (c >= '0' && c <= '9') x = x * 10 + (c - 48), c = getchar();
}
template <class T>
inline void gmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline void gmin(T &a, T b) {
  if (b < a) a = b;
}
using namespace std;
const int N = 2e6, M = 0, L = 0, Z = 1e9 + 7, maxint = 2147483647,
          ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double eps = 1e-8, PI = acos(-1.0);
map<int, int> mop;
struct A {};
int casenum, casei;
long long n, m, ans;
int a[N];
int main() {
  while (~scanf("%I64d", &n)) {
    m = 0;
    while (1) {
      m++;
      a[m] = 3 * m - 1;
      if (n < a[m]) break;
      n -= a[m];
    }
    if (n % 3 == 0)
      ans = m - 1;
    else if (n % 3 == 1) {
      ans = max(0ll, m - 2);
    } else if (n % 3 == 2) {
      ans = max(0ll, m - 3);
    }
    ans = (ans + 2) / 3;
    printf("%I64d\n", ans);
  }
  return 0;
}
