#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int N = 1e5;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  n *= 2;
  a = abs(a);
  b = abs(b);
  c = abs(c);
  d = abs(d);
  if (a > c) swap(a, c);
  if (b > d) swap(b, d);
  cout << (int)ceil((double)(c - a + d - b) / n) << "\n";
  return 0;
}
