#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <string>
#include <sstream>
#include <utility>
#include <ctime>
using std::priority_queue;
using std::vector;
using std::swap;
using std::stack;
using std::sort;
using std::max;
using std::min;
using std::pair;
using std::map;
using std::string;
using std::cin;
using std::cout;
using std::set;
using std::queue;
using std::string;
using std::istringstream;
using std::make_pair;
using std::greater;
typedef unsigned long long ULL;
ULL table[100];
bool vis[100];
ULL fun(int k)
{
if(vis[k])
return table[k];
table[k] = ~0ULL;
for(int i = 1; i < k; ++i)
table[k] = min(table[k], fun(i)*2+((1ULL << (k-i))-1));
vis[k] = true;
return table[k];
}
int main()
{
int N;
memset(vis, 0, sizeof(vis));
vis[1] = true;
table[1] = 1ULL;
while(~scanf("%d", &N))
{
printf("%I64u\n", fun(N));
}
return 0;
}