import java.util.Scanner;
import java.util.Arrays;
public class Main {
private static Scanner cin;
private static int[] rem = new int[501];
public static void main(String args[]) throws Exception {
cin = new Scanner(System.in);
Arrays.fill(rem,-1);
int n = cin.nextInt();
System.out.println(calc(n/2)+1);
}
private static int calc(int step) {
int ret = 0;
if(-1 != rem[step]) {
return rem[step];
}
if(step>=1) {
for(int i=1;i<=step;i++) {
if(-1 != rem[i]) {
ret = ret + rem[i]+1;
}else {
ret = ret + calc(i/2)+1;
rem[i] = ret;
}
}
}
return ret;
}
}