#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
using namespace std;
int fractal(int k, int x, int y, int x1, int x2, int y1, int y2) {
if ((x1 == x2) && (y1 == y2))
return 0;
int mean_x = (x1 + x2) / 2;
int mean_y = (y1 + y2) / 2;
int cost = pow(4, (k - 1)) - 1;
int costs[4] = {0, cost + 1, 2 * cost + 2, 3 * cost + 3};
if ((x <= mean_x) && (y <= mean_y)) {
return costs[0] + fractal(k - 1, y, x, x1, mean_x, y1, mean_y);
}
if ((x <= mean_x) && (y > mean_y)) {
return costs[1] + fractal(k - 1, x, y, x1, mean_x, mean_y + 1, y2);
}
if ((x > mean_x) && (y > mean_y)) {
return costs[2] + fractal(k - 1, x, y, mean_x + 1, x2, mean_y + 1, y2);
}
if ((x > mean_x) && (y <= mean_y)) {
return costs[3] + fractal(k - 1, y, x, y1, mean_y, mean_x + 1, x2);
}
return 0;
}
int main() {
ifstream fin("fractal.in");
int k, x, y;
fin >> k >> x >> y;
fin.close();
ofstream fout("fractal.out");
fout << fractal(k, x, y, 1, 1 << k, 1, 1 << k);
fout.close();
return 0;
}