#include<bits/stdc++.h>
using namespace std;
const int N = 10001;
int w,n,m,cnt = 1;
int main()
{
cin>>w>>n>>m;
if(n>m) swap(n,m);
int nx = (n-1)/w+1,ny = (n-1)%w+1;
int mx = (m-1)/w+1,my = (m-1)%w+1;
if(nx%2==0) ny = w-ny+1;
if(mx%2==0) my = w-my+1;
cout<<mx-nx+my-ny;
return 0;
}