#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int inf = (int)1e9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long n;
  cin >> n;
  long long fmin = 3 - n % 3;
  long long d = (long long)sqrt((long double)(1 + 24 * n));
  long long fmax = (d - 1) / 6;
  cout << (fmax - fmin + 3) / 3;
  return 0;
}
