#include <bits/stdc++.h>
using namespace std;
long long n, sum;
int main() {
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= 1000000; i++) {
    sum += i;
    ans += (n + i) % 3 == 0 && (n + i) / 3 >= sum;
  }
  cout << ans << "\n";
  return 0;
}
