This page is still under construction.

Parts of this page are still being built. What you see may change.

Mr. Miyagi's Earth Invasion Diary

Time limit8sMemory limit512 MB

Summary
Given N Draculas where exactly one is heavier than the rest, find the minimum number of balance-scale weighings needed in the worst case to identify the heavier original.
Level

Medium4 of 10

Topics
Math, Binary search, Greedy
Solved
No attempts yet

Problem

The Quarkgo Empire Expeditionary Force is an evil organization bent on invading Earth. Following the tradition of invaders, they kept sending one monster per week, targeting the area around Tokyo, Japan. But each time, five warriors calling themselves the Human Squadron Earth Five appeared, and the monster running wild in the city was easily defeated.

Warzard Through (Earth name: Minamoto Masa) is a female executive of the Quarkgo Empire Expeditionary Force who genuinely worries about this situation. She spent her days with a headache under a commander who learned nothing from each week's defeat and genius scientists who kept producing inventions that missed the mark.

The next operation was decided: send the vampire monster Draculas to Japan. Draculas is a terrifying monster that turns any human whose blood it drinks into a Draculas. A human whose blood is drunk by Draculas also drinks the blood of other humans and increases the number of fellow Draculas. The plan is to fill the entire Earth with Draculas this way.

Hearing this, Warzard immediately understood. This operation is on a different level from the petty operations they usually ran, like hijacking a kindergarten bus. Rare for something devised by that useless commander, it held a real chance of conquering Earth.

The momentum of a doubling game is frightening. The Draculas that landed on the ground multiplied its fellows in an instant. At this rate, the invasion of Earth seemed just around the corner. But at that moment, a strong bad premonition ran through Warzard's mind. Surely this monster does not have it so that if the original is defeated, its fellows are wiped out too?

She hurriedly pressed the scientist who designed and developed Draculas, and it was exactly as Warzard had feared. If the original Draculas is killed, every human whose blood was drunk is designed to return to normal. Damn you, developer. Why did you add such a useless feature!

After landing a flying knee kick on the developer in charge, Warzard immediately began recovering the original. No matter how identical the original and the fakes look, at this rate it was obvious that the arriving Earth Five would see through the original for some reason and win.

According to the developer, all humans turned into Draculas weigh the same, but the original Draculas is slightly heavier than that. If so, a balance scale should be able to find the original. Before Earth Five appears, she must find and recover the original Draculas as quickly as possible.

Input

N

The first line of input contains an integer N (2 ≤ N ≤ 2,000,000,000). This is the number of Draculas, counting the original and the fakes together.

Output

How many times is enough to use the balance scale, even in the worst case, to find the single original among N Draculas? Output that minimum. Placing some number of Draculas on each of the left and right pans of the balance scale and comparing their weights counts as one use.

Examples3

  1. Example 1

    Input
    8
    
    Expected output
    2
    
  2. Example 2

    Input
    30
    
    Expected output
    4
    
  3. Example 3

    Input
    2000000000
    
    Expected output
    20