#include <iostream>
#include <cmath>
using namespace std;
int res;
int w,m,n;
int c1,c2;
int r1,r2;
int main(){
cin>>w>>m>>n;
if(m % w == 0)
r1 = m / w ;
else
r1 = m / w + 1;
if(n % w == 0)
r2 = n / w ;
else
r2 = n / w + 1;
if(r1 % 2 == 0)
c1 = w - (m - (r1-1) * w) + 1;
else
c1 = m - (r1-1) * w;
if(r2 % 2 == 0)
c2 = w - (n - (r2-1) * w) + 1 ;
else
c2 = n - (r2-1) * w;
cout<<abs(r1 - r2) + abs(c1 - c2)<<endl;
return 0;
}