# d + [d/2] = x # [d/2] = x - d # x-d <= d/2 < x-d+1 # 2/3 x <= d < 2/3 (x + 1) # ceil(2/3 x) <= d < ceil(2/3 (x + 1)) d = int(input()) l, r = d, d + 1 ans = d while l < r: ans = l l, r = (2 * l + 2) // 3, (2 * r + 2) // 3 print(ans)