#include<stdio.h>
int main()
{
    long long num = 0;
    long long temp, decimal = 0, base = 1;
    int count = 0, bit, isNegative = 0;
    scanf("%lld", &num);
    temp = num;
    while(temp > 0)
    {
        bit = temp % 10;
        if(bit != 0 && bit != 1)
        {
            printf("Invalid Input");
        }
        temp /= 10;
        count++;
    }
    if(count == 0 || count > 32)
    {
        printf("Invalid Input");
    }
    temp = num;
    long long msbcheck = 1;
    for(int i = 1; i < count; i++)
    {
        msbcheck *= 10;
    }
    if(num / msbcheck == 1)
    {
        isNegative = 1;
    }
    while(temp > 0)
    {
        bit = temp % 10;
        decimal += bit * base;
        base *= 2;
        temp /= 10;
    }
    long long signbitvalue = 1LL << (count - 1);
    if(decimal >= signbitvalue)
    {
        decimal = decima
    }
    printf("%lld", decimal);
    return 0;
}