import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class CF287B {
	private FastScanner in;
	private PrintWriter out;
	
	class Pair implements Comparable<Pair> {
		int a;
		int b;
		
		public Pair(int a, int b){
			this.a = a;
			this.b = b;
		}
		
		public int compareTo(Pair pair){
			int c = Integer.compare(this.a, pair.a);
			if (c != 0){
				return c;
			}
			return Integer.compare(this.b, pair.b);
		}
	}
	
	public void solve() throws IOException {
		int r = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int xx = in.nextInt();
		int yy = in.nextInt();
		int num = 0;
		for (int i = 0; i < 100000; i++){
			if (x >= xx && y >= yy){
				break;
			}
			ArrayList<Pair> a = new ArrayList<Pair>();
			a.add(new Pair(x+r, y+r));
			a.add(new Pair(x-r, y-r));
			a.add(new Pair(x+2*r, y));
			a.add(new Pair(x, y+2*r));
			a.add(new Pair(x-2*r, y));
			a.add(new Pair(x, y-2*r));
			Pair bst = a.get(0);
			for (int j = 0; j < a.size(); j++){
				Pair nx = a.get(j);
				double dist1 = Math.sqrt((nx.b - yy)*(nx.b - yy) + (nx.a - xx)*(nx.a - xx));
				double dist2 = Math.sqrt((bst.b - yy)*(bst.b - yy) + (bst.a - xx)*(bst.a - xx));
				if (dist1 < dist2){
					bst = nx;
				}
			}
			x = bst.a;
			y = bst.b;
			num++;
			if (xx == x && yy == y){ out.println(num); return; }
		}
		if (xx != x && yy != y){
			out.println(0);
			return;
		}
		out.println(num);
	}

	public static void main(String[] args) {
		new CF287B().run();
	}

	public void run() {
		try {
			in = new FastScanner();
			out = new PrintWriter(System.out);
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}
