#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, x, y, a, b, sum = 0;
  cin >> r >> x >> y >> a >> b;
  if (a < 0 && b < 0) {
    int s = 0;
    while (x >= a && y >= b) {
      s = 1;
      if (x == a && y == b) {
        break;
      } else {
        a = a + r;
        b = b + r;
        sum++;
      }
    }
    while (s != 1 && x <= a && y <= b) {
      if (x == a && y == b) {
        break;
      } else {
        x = x - r;
        y = y - r;
        sum++;
      }
    }
  } else if (a >= 0 && b >= 0) {
    int s = 0;
    while (x <= a && y <= b) {
      s = 0;
      if (x == a && y == b) {
        break;
      }
      x = x + r;
      y = y + r;
      sum++;
    }
    while (s != 1 && x <= a && y <= b) {
      if (x == a && y == b) {
        break;
      } else {
        x = x - r;
        y = y - r;
        sum++;
      }
    }
  } else {
    int s;
    if (x >= a && y <= b) {
      s = 0;
      while (x >= a && y <= b) {
        s = 1;
        if (x == a && y == b) {
          break;
        } else {
          a = a + r;
          b = b - r;
          sum++;
        }
      }
    }
    while (s != 1 && x <= a && y >= b) {
      if (x == a && y == b) {
        break;
      } else {
        a = a - r;
        b = b + r;
        sum++;
      }
    }
  }
  cout << sum << endl;
}
