#include <bits/stdc++.h>
using namespace std;
const int N = 2001;
const long double PI = 3.14159265358979323;
pair<int, int> arr[N];
int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  int ans = 0;
  for (long long h = 1; h * h <= n; h++) {
    long long c = n - (h * (h + 1) / 2) * 3LL + h;
    if (c >= 0 && c % 3 == 0) ans++;
  }
  cout << ans << endl;
  getchar(), getchar();
  return 0;
}
