#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > AdjList;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  long long int in;
  cin >> in;
  int ans = 0;
  long long int could = 2;
  for (int i = 1; i < 1000000; i++) {
    if ((in + i) % 3 == 0 && could <= in) {
      ans++;
    }
    could += 2 + (i)*3;
  }
  cout << ans << endl;
  return 0;
}
