#!/usr/bin/env python3
from math import ceil, log2

n = int(input())
hits = ceil(-log2(2 / n))
print(hits + ceil(n * 2 ** -hits))
