#include <bits/stdc++.h>
const int maxn = (int)1e6;
const int mod = (int)1e9 + 7;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, cnt = 0;
  cin >> n;
  for (long long i = 1; (i + 1) * i / 2 * 3 <= n + i; i++) {
    if ((i + n) % 3 == 0) cnt++;
  }
  cout << cnt;
  return 0;
}
