#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  int ans = 0, H = 1;
  long long int cur = 0;
  while (1) {
    cur += 2 * H + H - 1;
    if (cur > n) break;
    if ((n - cur) % 3 == 0) ans++;
    H++;
  }
  cout << ans;
}
