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