import sys import math sys.setrecursionlimit(10 ** 7) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) def NIJIGEN(H): return [list(input()) for i in range(H)] import sys import math sys.setrecursionlimit(10 ** 7) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) def NIJIGEN(H): return [list(input()) for i in range(H)] ans=0 N=int(input()) s=N while True: ans+=1 N=N//3 if N==1: break if 3**ans