#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long n1 = 0;
  int i1 = 1;
  while (n1 <= n) {
    n1 += (2 + i1 * 3);
    i1++;
  }
  i1--;
  int ans = 0;
  for (int i = 1; i <= i1; i++) {
    if ((n - 2) % 3 == 0) ans++;
    n -= 2;
  }
  cout << ans;
  return 0;
}
