#include <bits/stdc++.h>
using namespace std;
ifstream fin("fractal.in");
ofstream fout("fractal.out");
int calc(int k, int x, int y){
if(k == 1){
if(x == 1 && y == 1) return 0;
else if(x == 2 && y == 1) return 1;
else if(x == 2 && y == 2) return 2;
else return 3;
}
k--;
int med = (1 << k), nrs = (1 << (k * 2));
if(x <= med && y <= med) return calc(k, y, x);
else if(x > med && y <= med) return nrs + calc(k, x - med, y);
else if(x > med && y > med) return nrs * 2 + calc(k, x - med, y - med);
else if(x <= med && y > med) return nrs * 3 + calc(k,(med << 1) - y + 1, x - med + 1);
}
int main()
{
int k,x,y;
fin >> k >> x >> y;
fout << calc(k,y,x);
return 0;
}