using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math;class Program { static void Main(string[] args) { //var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn ); //const long inf = 100000000000000; long a = int.Parse(Console.ReadLine()); long tmp = a; long ans; long cnt = 0; while(tmp>0){ tmp/=2; cnt++; } ans = cnt*2; tmp = a; cnt = 0; while(tmp>0){ tmp/=3; cnt++; } ans = Min(ans, cnt*3); Console.WriteLine(ans); } }