import java.io.*; import java.util.*; public class B_FewQuestions { private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static StringTokenizer st; private static long readLong() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return Long.parseLong(st.nextToken()); } public static void main(String[] args) throws IOException { long A = readLong(); long min = Math.min(2 * (int)(Math.ceil(Math.log(A)/Math.log(2))), 3 * (int)(Math.ceil(Math.log(A)/Math.log(3)))); System.out.println(min); } }