import sys import math def main(): text = sys.stdin.readline() bisckets_n = int(text) bisckets_ini = 1 bisckets_total = 0 tap_count = 0 tap_total = 0 while (bisckets_n - bisckets_total) > 1: tap_count = math.floor((math.log10(bisckets_n - bisckets_total) - math.log10(bisckets_ini)) / math.log10(2)) bisckets_total += pow(bisckets_ini * 2,tap_count) if (bisckets_n - bisckets_total) == 1 : bisckets_ini = 1.0 else: bisckets_ini = math.floor((bisckets_n - bisckets_total) / 2) tap_total += tap_count #print("tap:" + str(tap_count),"total biskets:" + str(bisckets_total),"next biskets:" + str(bisckets_ini)) print(tap_total) if __name__ == "__main__": main()