#include <bits/stdc++.h>
using namespace std;
long long n, sm, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long k = 1; k < 1000000; ++k) {
    sm += k;
    if ((n + k) % 3) continue;
    if ((k + n) / 3 >= sm) ++ans;
  }
  cout << ans << "\n";
}
