The lightest pearl

“Given eight identical pearls, except for one that is a little lighter, how do you find which one is the lightest pearl with only two weighings?”

This is the last problem that the seven sages put to Beremiz, who solved the problem easily.

Input

Input consists of several cases, each with a natural number pp between 1 and 10910^9.

Output

For every case, print the minimum number of the weighings to identify with certainty, given pp identical pearls, except for one that is a little lighter, which is the lightest pearl. Suppose that the scale can only compare the weight of two groups with the same (arbitrarily large) number of pearls.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T10:00:37.987Z

© Jutge.org, 2006–2026.
https://jutge.org