#include <bits/stdc++.h>
using namespace std;
int gcd(int n, int m) { return m ? gcd(m, n % m) : n; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, pre, temp;
  cin >> n >> temp >> pre;
  int _gcd = abs(temp - pre), _min = min(temp, pre), _max = max(temp, pre);
  for (int i = 2; i < n; i++) {
    cin >> temp;
    _gcd = gcd(_gcd, abs(temp - pre));
    _min = min(_min, temp);
    _max = max(_max, temp);
    pre = temp;
  }
  cout << (_max - _min) / _gcd - n + 1 << endl;
  return 0;
}
