#include <bits/stdc++.h>
using namespace std;
ifstream fin("fractal.in");
ofstream fout("fractal.out");
int k, x, y, cost;
void divide(int k, int x, int y, int a, int b, int l)
{
if(k==0)
return ;
if(a+l/2-1>=x && b+l/2-1>=y)
divide(k-1,x,y,a,b,l/2);
else if(a+l/2<=x && b+l/2-1>=y)
{
cost+=(l/2)*(l/2);
divide(k-1,x,y,a+l/2,b,l/2);
}
else if(a+l/2<=x && b+l/2<=y)
{
cost+=2*(l/2)*(l/2);
divide(k-1,x,y,a+l/2,b+l/2,l/2);
}
else
{
cost+=3*(l/2)*(l/2);
divide(k-1,x,y,a,b+l/2,l/2);
}
}
int main()
{
fin>>k>>x>>y;
int i, j, l;
l=(int)powl(2,k);
divide(k,x,y,1,1,l);
fout<<cost<<'\n';
return 0;
}