#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  while (cin >> a >> b >> c >> d >> e) {
    int x = abs(b - d);
    int y = abs(c - e);
    int ans = 0;
    int g = a;
    a *= 2;
    int t1, t2;
    t1 = x / a;
    x %= a;
    t2 = y / a;
    y %= a;
    if (x || y) {
      ans++;
    }
    ans += max(t1, t2);
    cout << ans << '\n';
  }
  return 0;
}
