#include <bits/stdc++.h>
using namespace std;
long long int n, m, i, j, k, l, a[1000009], b[1000009], p[1000009], ans, cn, t,
    x, y, z, mx, mn, s, lo, hi, mid;
char c[1000009], d[1000009], ch;
long long int isP(long long int flor) {
  long long int num = n;
  long long int pos = 0;
  while (2 + pos * 3 <= num) {
    num -= (2 + pos * 3);
    pos++;
    if ((pos == flor) && (num % 3 == 0)) {
      return 1;
    }
  }
  return 0;
}
int main() {
  while (scanf("%I64d", &n) != EOF) {
    x = n % 3;
    if (x == 0) {
      x = 3;
    } else if (x == 2) {
      x = 1;
    } else {
      x = 2;
    }
    ans = 0;
    lo = 0;
    hi = 1000000000000LL;
    while (lo <= hi) {
      mid = (lo + hi) / 2;
      if (isP(mid * 3 + x) == 1) {
        ans = mid + 1;
        lo = mid + 1;
      } else {
        hi = mid - 1;
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
