
[java]
import java.io.*;
import java.util.*;
class Main
{
static String ReadLn (int maxLg) // utility function to read from stdin
{
byte lin[] = new byte [maxLg];
int lg = 0, car = -1;
String line = "";
try
{
while (lg < maxLg)
{
car = System.in.read();
if ((car < 0) || (car == '\n')) break;
lin [lg++] += car;
}
}
catch (IOException e)
{
return (null);
}
if ((car < 0) && (lg == 0)) return (null); // eof
return (new String (lin, 0, lg));
}
static int x;
static int y;
static int level;
static int square;
static int sx;
static int sy;
static int p;
static int k;
public static void main(String args[]) throws Exception {
String s;
while(!((s=ReadLn(255)).trim()).equals("0 0 0")) {
StringTokenizer st=new StringTokenizer(s);
int largest=Integer.parseInt(st.nextToken());
x=Integer.parseInt(st.nextToken());
y=Integer.parseInt(st.nextToken());
int tmp=0;
level=0;
square=0;
while(tmp<largest) {
tmp=(int)Math.pow(2,level++);
}
level--;
sy=1025;
sx=1025;
k=largest;
chkSquare(level);
System.out.println(padd(square));
}
}
public static String padd(int n) {
String s=new Integer(n).toString();
int l=s.length();
//System.out.println(l);
String r="";
for(int i=0;i<(3-l);i++) {
r+=" ";
}
r+=s;
return r;
}
public static void chkSquare(int l) {
p=k;
if(p==0) {
return;
}
if((x>=(sx-p))&&(x<=(sx+p))) {
if((y>=(sy-p))&&(y<=(sy+p))) {
square++;
}
}
if((x<=sx)&&(y<=sy)) {
sx=sx-p;
sy=sy-p;
k=k/2;
chkSquare(--l);
}
else if((x>=sx)&&(y<=sy)) {
sx=sx+p;
sy=sy-p;
k=k/2;
chkSquare(--l);
}
else if((x<=sx) &&(y>=sy)) {
sx=sx-p;
sy=sy+p;
k=k/2;
chkSquare(--l);
}
else if((x>=sx)&&(y>=sy)) {
sx=sx+p;
sy=sy+p;
k=k/2;
chkSquare(--l);
}
}
}
[/java]