public void solve() throws IOException {
    long cards = nextLong();
    long floors = 1;
    long maxcards = 2;
    while (maxcards <= cards) {
      maxcards = 2 * (floors + 1) + 3 * (floors) * (floors + 1) / 2;
      floors++;
    }

    int total = 0;
    int mod = (int) (cards % 3);
    for (int x = 1; x < floors; x++) {
      if ((2 * x) % 3 == mod) {
        total++;
      }
    }

    System.out.println(total);
  }