You are a lover of bacteria. You want to raise some bacteria in a box. 

Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hope to see exactly *x* bacteria in the box at some moment. 

What is the minimum number of bacteria you need to put into the box across those days?
The only line containing one integer *x* (1 ≤ *x* ≤ 10<sup class="upper-index">9</sup>).
import io
import os
import sys
import collections as clts
import math
import heapq
import functools as ft
 
#====== Mathematical Utility =======#
MOD = 10**9 + 7;
MOD2 = 998244353;
def gcd(x,y):
    if y == 0:
        return x
    else: return gcd(y,x%y)
def lcm(x,y): return int(x/gcd(x,y)*y)
def prime_sieve(n):
    primes = [True]*(n+1);
    p = 2;
    while p*p <= n:
        if primes[p]:
            i = p+p;
            while i <= n:
                primes[i] = False;
                i+=p;
        p+=1;
    primeNos = [i for i in range(2,n+1) if primes[i] is True];    
    return primeNos;
    
#======== Binary Utility ========#
def bin_str(n,bits):
    s = []
    while len(s)!=bits:
        s.append(str(n&1))
        n>>=1
    s=s[::-1]
    return ''.join(s)
def bin_search(key,a,l,r):
    # Binary search to return the next greatest element in the array corresponding
    # to the given key or if it is equal to key then that index.
    # initial state: l = 0 and r = n-1;
    mid = (l+r)//2
    if l>r: return l
    
    if a[mid] == key:
        return mid
    elif key < a[mid]:
        if l == r: return l
        return bin_search(key,a,l,mid)
    else: return bin_search(key,a,mid+1,r)
    
#====== I/O Optimization ========#
FAST = True;
MODE = "ONLINE";
FILEMETA = {
    'LINECTR': 0,
    'FILEINP': []
};
if FAST:
    INP = io.BytesIO(os.read(0,os.fstat(0).st_size)) #global file input variable
def take_input(inp_type='list-int'):
    global FAST;
    global MODE;
    global FILEMETA;
    
    if MODE == "OFFLINE":
        if len(FILEMETA['FILEINP']) == 0:
            with open('C:\\Users\\Arsh\\Desktop\\CP testcase.txt', 'r') as fptr:
                for line in fptr:
                    FILEMETA['FILEINP'].append(line);
            inp = FILEMETA['FILEINP'][FILEMETA['LINECTR']];
            FILEMETA['LINECTR']+=1;
        else:
            inp = FILEMETA['FILEINP'][FILEMETA['LINECTR']];
            FILEMETA['LINECTR']+=1;  
    else:
        if FAST:
            global INP
            inp = INP.readline().decode().rstrip()
        else: inp = input()
    
    if inp_type == 'list-int':
        out = list(map(int,inp.split()))
    elif inp_type == 'list-float':
        out = list(map(float,inp.split()))
    elif inp_type == 'list-str':
        out = inp.split()
    elif inp_type == 'str':
        out = inp
    elif inp_type == 'int':
        out = int(inp)
    elif inp_type == 'float':
        out = float(inp)
    else:
        out = None
    return out

# for _ in range(take_input('int')):
x = take_input('int');
print(x-pow(2,math.floor(math.log2(x)))+1);
                
            
    