#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, ans, m;
  cin >> n;
  m = sqrt((n * 2) / 3);
  if (3 * m * m + m > 2 * n) m--;
  if (m % 3 != (2 * (n % 3)) % 3) m--;
  if (m % 3 != (2 * (n % 3)) % 3) m--;
  ans = (m + 2) / 3;
  cout << ans << endl;
}
