# Programmer: Sriram Pemmaraju
# Date: Feb 13, 2015

# Get input
n = int(input())
dec = 0 # we will build the decimal equivalent in this variable
placeValue = 1 # the place value of the right most bit is 1

# Repeatedly extract bits from n, right-to-left
while n > 0:
    bit = n % 10 # get the rightmost bit
    dec = dec + bit * placeValue # update dec by value of new bit
    placeValue = placeValue * 2 # update place value
    n = n // 10 # everything except the last digit is reassigned to n

print(dec)
