/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
typedef long long LL;
using namespace std;
double f[65];
double pow(int x, int num){
double ans = 1;
for (int i = 1; i <= num; i++){
ans *= x;
}
return ans;
}
void init(){
f[1] = 1;
f[2] = 3;
for (int i = 3; i <= 64; i++){
double minn = 0x3f3f3f3f;
for (int j = 1; j < i; j++){
minn = min(minn, 2 * f[j] + pow(2, i - j) - 1);
}
f[i] = minn;
}
}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
int n;
init();
while(scanf("%d", &n) == 1){
printf("%d\n", (int)f[n]);
}
return 0;
}
/**/