#include<stdio.h>
int main()
{
    int rotated;
    scanf("%d",&N);
    if(N >= 128){
        rotated=(N-128)*2+1;
        else{
            rotated=N*2
        }
        printf("%d",rotated);
        return 0;
    }
}