/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package amrandpins;
import java.util.*;
/**
 *
 * @author Rawhi
 */
public class AmrAndPins {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt(),x = sc.nextInt(),y = sc.nextInt(),xP = sc.nextInt(),yP = sc.nextInt();
        int totalSteps = 0, lastX = x, lastY = y;
        boolean flag = true;
        while (flag) {
            if(x < xP){
                x += r;
                if(lastY == yP){
                    x += r;
                }
                //System.out.println("X<");
            }else if( x > xP){
                //System.out.println("X>");
                x -= r;
                if(lastY == yP){
                    x -= r;
                }
            }else{
                //System.out.println("X=");
                if(y == yP){
                    break;
                }
            }
            if(y < yP){
                //System.out.println("Y<");
                y += r;
                if(lastX == xP){
                    y += r;
                }
            }else if( y > yP){
                //System.out.println("Y>");
                y -= r;
                if(lastX == xP){
                    y -= r;
                }
            }else{
                //System.out.println("Y=");
                if(x == xP){
                    break;
                }
            }
            lastX = x;
            lastY = y;
            //System.out.println("Round");
            totalSteps++;
        }
        System.out.println(totalSteps);
    }
    
}
