#include <bits/stdc++.h>
using namespace std;
int find_min(int r, int x0, int y0, int x, int y) {
  static int count;
  if (x == x0 && y == y0) return count;
  count++;
  if (x - x0 == r && y - y0 == r) return count;
  if (abs(x - x0) <= r && abs(x - x0) != 0)
    return find_min(r, x, y0, x, y);
  else if (abs(y0 - y) <= r && abs(y - y0) != 0)
    return find_min(r, x0, y, x, y);
  else if (x - x0 > r) {
    if (y - y0 > r)
      return find_min(r, x0 + r, y0 + r, x, y);
    else if (y0 == y)
      return find_min(r, x0 + 2 * r, y0, x, y);
    else
      return find_min(r, x0 + r, y0 - r, x, y);
  } else if (x0 - x > r) {
    if (y - y0 > r)
      return find_min(r, x0 - r, y0 + r, x, y);
    else if (y0 == y)
      return find_min(r, x0 - 2 * r, y0, x, y);
    else
      return find_min(r, x0 - r, y0 - r, x, y);
  } else if (x0 == x) {
    if (y - y0 > r)
      return find_min(r, x0, y0 + 2 * r, x, y);
    else
      return find_min(r, x0, y0 - 2 * r, x, y);
  }
}
int main() {
  int r, x0, y0, x, y;
  cin >> r >> x0 >> y0 >> x >> y;
  int ans = find_min(r, x0, y0, x, y);
  cout << ans;
}
