#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
const long double pi = 3.141592653589793;
const long double eps = 1e-12;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
bool vis[N];
long long n, cnt, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  if (n == 4) return cout << "0", 0;
  double x = (4.0 * n) / 3;
  x += 6;
  x = (x * 8.0) + 1;
  double y = sqrt(x);
  y = (y - 1) / 4.0;
  long long high = ceil(y);
  long long a = (high * 2) + ((high * (high - 1)) / 2) * 3;
  if (a == n) high++;
  for (long long i = 1; i < high; ++i) {
    long long a = n - (i * 2);
    a /= 3;
    if (((a * 3) + (i * 2)) == n) ans++;
  }
  cout << ans;
}
