line = gets.split(' ').map(&:to_i)
a=line[1]
b=line[2]
if ((a-b).abs)%2==0 then
  p ((a-b).abs)/2
elsif ((a-b).abs)%2!=0 then
  if (a-b).abs==1 then
    p [[a,b].max-1,line[0]-[a,b].min].min
  else
    p [[a,b].min-1,line[0]-[a,b].max].min+(((a-b).abs)/2)+1
  end
end