#include <bits/stdc++.h>
using namespace std;
const int INF = 1000009, mod = (int)1e9 + 9;
long long n, ans;
int main() {
  cin >> n;
  for (int i = (1); i <= (1000000); i++) {
    if ((i + n) % 3 == 0) {
      long long t = (i + n) / 3;
      if ((long long)(1 + i) * (long long)i / 2 <= t) ans++;
    }
  }
  cout << ans;
  return 0;
}
