a = int(input()) i = 1 while pow(2, i) < a: i += 1 j = 1 while pow(3, j) < a: j += 1 print(min(2*i, 3*j))