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