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