There are n points on a straight line, and the i-th point among them is located at x_{i}. All these coordinates are distinct.

Determine the number m — the smallest number of points you should add on the line to make the distances between all neighboring points equal. 


-----Input-----

The first line contains a single integer n (3 ≤ n ≤ 100 000) — the number of points.

The second line contains a sequence of integers x_1, x_2, ..., x_{n} ( - 10^9 ≤ x_{i} ≤ 10^9) — the coordinates of the points. All these coordinates are distinct. The points can be given in an arbitrary order.


-----Output-----

Print a single integer m — the smallest number of points you should add on the line to make the distances between all neighboring points equal. 


-----Examples-----
Input
3
-5 10 5

Output
1

Input
6
100 200 400 300 600 500

Output
0

Input
4
10 9 0 -1

Output
8



-----Note-----

In the first example you can add one point with coordinate 0.

In the second example the distances between all neighboring points are already equal, so you shouldn't add anything.

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
from fractions import gcd
n = int(input())
m = list(map(int, input().split()))
m.sort()
g = m[1] - m[0]
for i in range(2, n):
	g = gcd(g, m[i] - m[i - 1])
ans = 0
for i in range(1, n):
	ans += (m[i] - m[i - 1]) // g - 1
print(ans)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
res = abs(arr[1] - arr[0])
for i in range(1, n - 1):
	res = gcd(res, abs(arr[i] - arr[i + 1]))
c = 0
for i in range(n - 1):
	if abs(arr[i] - arr[i + 1]) > res:
		c += abs(arr[i] - arr[i + 1]) / res - 1
print(int(c))


from math import gcd
n = int(input())
x = sorted(list(map(int, input().split())))
x1 = [0] * (2 * n)
for i in range(0, n - 1):
	x1[i] = x[i + 1] - x[i]
g = x1[0]
for i in range(1, n - 1):
	g = gcd(g, x1[i])
c = 0
for i in range(0, n - 1):
	c += x1[i] / g - 1
print(int(c))


import math
(n, a, q, w) = (int(input()), sorted(map(int, input().split())), 0, 0)
for i in range(1, n):
	q = math.gcd(q, a[i] - a[i - 1])
for i in range(1, n):
	w += abs(a[i] - a[i - 1]) // q - 1
print(w)


import math
from functools import reduce
n = input()
ints = [int(x) for x in input().split(' ')]
ints = sorted(ints)
dists = [ints[x] - ints[x - 1] for x in range(1, len(ints))]
gcd = reduce(math.gcd, dists)
ans = reduce(lambda a, b: a + (b // gcd - 1), dists, 0)
print(ans)


from fractions import gcd
a = int(input())
data = [int(x) for x in input().split()]
data.sort()
difs = []
firstDif = data[1] - data[0]
allGood = True
res = 0
for i in range(a - 1):
	difs.append(data[i + 1] - data[i])
	if data[i + 1] - data[i] != firstDif:
		allGood = False
difs.sort()
gc = gcd(difs[1], difs[0])
if allGood:
	print(0)
else:
	for i in range(0, len(difs)):
		gc = gcd(gc, difs[i])
	for i in range(0, len(difs)):
		res = res + (difs[i] - 1) // gc
	print(res)


def nod(a, b):
	if b == 0:
		return a
	else:
		return nod(b, a % b)

def main():
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	no = 0
	for i in range(1, n):
		no = nod(arr[i] - arr[i - 1], no)
	ans = 0
	for i in range(1, n):
		ans += -1 + (arr[i] - arr[i - 1]) // no
	print(ans)
main()


from math import gcd
from functools import reduce
size = int(input())
str = [int(i) for i in input().split()]
str.sort()
a = [int(str[i] - str[i - 1]) for i in range(1, size)]
a.sort()
grcd = reduce(gcd, a)
ans = 0
start = str[0]
end = str[size - 1]
ans = (end - start) // grcd
print(ans - size + 1)


n = input().split(' ')
a = list(map(int, input().split()))
a.sort()
i = 0
d = []
while i < len(a) - 1:
	d.append(a[i + 1] - a[i])
	i += 1

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
g = 0
if len(d) == 1:
	g = d[0]
else:
	g = gcd(d[0], d[1])
	i = 2
	while i < len(d):
		g = gcd(g, d[i])
		i += 1
ans = 0
for i in d:
	ans += i // g - 1
print(ans)


def gcd(a, b):
	while a != b and a != 0 and (b != 0):
		if a > b:
			a = a % b
		else:
			b = b % a
	return max(a, b)
n = int(input())
array = input().split()
array = list(map(int, array))
array = sorted(array)
g = 0
for i in range(n - 1):
	a = int(array[i + 1]) - int(array[i])
	g = gcd(a, g)
ans = 0
for i in range(n - 1):
	ans = ans + (int(array[i + 1]) - int(array[i])) / g - 1
print(int(ans))


def GCD(a, b):
	if a % b == 0:
		return b
	else:
		return GCD(b, a % b)
input()
s = [int(_) for _ in input().split()]
s.sort()
ans = s[-1] - s[0]
for i in range(1, len(s)):
	ans = GCD(ans, s[i] - s[i - 1])
print((s[-1] - s[0]) // ans + 1 - len(s))


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[1] - v[0]
for i in range(2, n):
	ans = gcd(ans, v[i] - v[i - 1])
print((v[len(v) - 1] - v[0]) // ans + 1 - n)


def gcd(a, b):
	if a == 0:
		return b
	while b:
		a %= b
		[a, b] = [b, a]
	return a
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
tek = 0
res = 0
for x in a:
	if x != a[0]:
		res = gcd(res, x - tek)
	tek = x
print((tek - a[0]) // res - n + 1)


def gcd(a, b):
	while b != 0:
		tmp = a
		a = b
		b = tmp % a
	return a
input()
x = sorted([int(i) + 1000000001 for i in input().split()])
ans = x[1] - x[0]
for i in range(1, len(x)):
	ans = gcd(x[i] - x[i - 1], ans)
res = 0
for i in range(1, len(x)):
	res += (x[i] - x[i - 1]) // ans - 1
print(res)


def gcd(a, b):
	while a != 0 and b != 0:
		if b > a:
			b = b % a
		else:
			a = a % b
	if a == 0:
		return b
	else:
		return a
n = int(input())
a = input()
a = a.split()
for i in range(len(a)):
	a[i] = int(a[i])
a = sorted(a)
b = a[1] - a[0]
for i in range(0, len(a) - 1):
	b = gcd(b, a[i + 1] - a[i])
cnt = (a[len(a) - 1] - a[0]) // b + 1
print(cnt - n)


n = input()
x = list(map(int, input().split()))
x.sort()

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
g = x[1] - x[0]
for i in range(2, len(x)):
	g = gcd(g, x[i] - x[i - 1])
acc = 0
for i in range(1, len(x)):
	acc = acc + (x[i] - x[i - 1]) / g - 1
print(int(acc))


from functools import reduce

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
input()
arr = sorted(list(map(int, input().split())))
new_arr = []
for i in range(len(arr) - 1):
	new_arr.append(abs(arr[i + 1] - arr[i]))
min_l = reduce(gcd, new_arr)

def fucn(a):
	if min_l == a:
		return 0
	return a // min_l - 1
new_arr = list(map(fucn, new_arr))
print(sum(new_arr))


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
th = 0
a = []
a = sorted(list(map(int, input().split())))
e1 = a[0]
e2 = a[-1]
b = []
for i in range(len(a) - 1):
	b.append(a[i + 1] - a[i])
st = b[0]
for i in range(len(b) - 1):
	st = gcd(st, b[i + 1])
otv = (e2 - e1) // st + 1 - n
print(otv)


import sys

def gcd(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return max(a, b)
n = int(input())
s = input()
num = list(map(int, s.split(' ')))
num.sort()
slen = []
for i in range(1, n):
	slen.append(num[i] - num[i - 1])
slen.sort()
minlen = slen[0]
maxlen = slen[-1]
for i in range(0, n - 1):
	if minlen == 1:
		break
	elif slen[i] % minlen != 0:
		minlen = gcd(minlen, slen[i])
print(int((num[-1] - num[0]) / minlen - n + 1))


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
difference = []
for i in range(len(arr) - 1):
	difference.append(arr[i + 1] - arr[i])
g = difference[0]
for i in difference[1:]:
	g = gcd(g, i)
summ = 0
for i in difference:
	summ += i // g - 1
print(summ)


import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
g = 0
s = 0
for i in range(1, n):
	g = math.gcd(g, a[i] - a[i - 1])
print((a[n - 1] - a[0]) // g + 1 - n)


def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = int(input())
a = list(map(int, input().split()))
a.sort()
(g, res) = (0, 0)
for i in range(n):
	if i != 0:
		g = computeGCD(g, a[i] - a[i - 1])
for i in range(n):
	if i != 0:
		res += (a[i] - a[i - 1]) / g - 1
print(int(res))


from fractions import gcd
n = int(input())
v = [int(x) for x in input().split()]
v.sort()
g = 0
last = v[0]
for i in v:
	if i != last:
		g = gcd(g, i - last)
		last = i
ans = (v[n - 1] - v[0]) // g - n + 1
print(ans)


def lcm(a, b):
	m = a * b
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	return a + b
n = int(input())
s = input()
points = [int(i) for i in s.split()]
points = sorted(points)
dist = []
for i in range(len(points) - 1):
	dist.append(points[i + 1] - points[i])
c = dist[0]
for i in range(1, len(dist)):
	c = lcm(c, dist[i])
ans = 0
for i in range(len(dist)):
	ans += dist[i] // c - 1
print(int(ans))


from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(1, len(a)):
	a[i - 1] = a[i] - a[i - 1]
a.pop()
g = a[0]
s = 0
for i in range(len(a)):
	s += a[i]
	g = gcd(g, a[i])
s = s // g - len(a)
print(s)


def gcd(a, b):
	a = int(a)
	b = int(b)
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
a = input().split()
for i in range(0, n):
	a[i] = int(a[i])
a = sorted(a)
d = 0
for i in range(1, n):
	d = gcd(d, a[i] - a[i - 1])
print(int((a[n - 1] - a[0]) / d - n + 1))


def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x
a = input()
a = int(a)
x = sorted(list(map(int, input().split())))
mn = 0
cnt = 0
i = 0
for i in range(a):
	if cnt > 0:
		mn = gcd(x[i] - x[i - 1], mn)
	cnt = cnt + 1
ans = 0
cnt = 0
i = 0
for i in range(a):
	if cnt > 0:
		ans = ans + ((x[i] - x[i - 1]) // mn - 1)
	cnt = cnt + 1
print(ans)


n = int(input())
a = sorted([int(x) for x in input().split()])

def mcd(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
min_ = mcd(a[1] - a[0], a[2] - a[1])
for i in range(3, n):
	min_ = mcd(min_, a[i] - a[i - 1])
	if min_ == 1:
		break
count = 0
for i in range(1, n):
	count += (a[i] - a[i - 1]) // min_ - 1
print(count)


from fractions import gcd
n = int(input())
node = sorted(list(map(int, input().split())))
l = int(gcd(node[1] - node[0], node[2] - node[1]))
cou = int(0)
for i in range(n - 2):
	l = gcd(l, node[i + 2] - node[i + 1])
for i in range(n - 1):
	cou = int(cou + (node[i + 1] - node[i]) / l - 1)
print(cou)


n = int(input())
a = [int(x) for x in input().strip().split()]
a = sorted(a)
d = []
for i in range(len(a) - 1):
	d.append(a[i + 1] - a[i])

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
g = d[0]
for e in d:
	g = gcd(g, e)
cnt = len(a)
print(int((a[len(a) - 1] - a[0]) / g + 1 - cnt))


n = int(input())
a = [int(i) for i in input().split()]
min1 = 1000000000
check = 0
a.sort()
for i in range(n):
	if a[i] <= 0:
		if a[i] < min1:
			min1 = a[i]
		check = 1
if check == 1:
	for i in range(n):
		a[i] += -min1 + 1
k = a[1] - a[0]
k1 = 0
k2 = 0
for i in range(1, n):
	k1 = k
	k2 = a[i] - a[i - 1]
	while k1 != 0 and k2 != 0:
		if k1 > k2:
			k1 = k1 % k2
		else:
			k2 = k2 % k1
	k = k1 + k2
min1 = 1000000000
max1 = -1000000000
min1 = min(a)
max1 = max(a)
max1 = max1 // k * k
min1 = min1 // k * k
print((max1 - min1) // k + 1 - n)


n = int(input())
xs = [int(s) for s in input().split()]

def gcd(a: int, b: int):
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)
gcd_all = xs[1] - xs[0]
for i in range(n - 1):
	gcd_all = gcd(gcd_all, abs(xs[i + 1] - xs[i]))
result = (max(xs) - min(xs)) // gcd_all - n + 1
print(result)


def Evkl(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
n = int(input())
string = input()
x = []
lens = []
for i in string.split(' '):
	x.append(int(i))
x.sort()
for i in range(0, n - 1):
	lens.append(abs(x[i] - x[i + 1]))
lens.sort()
min_len = lens[0]
max_len = lens[-1]
for i in range(1, n - 1):
	if min_len == 1:
		break
	if lens[i] % min_len != 0:
		min_len = Evkl(lens[i], min_len)
print(abs(x[0] - x[-1]) // min_len - n + 1)


import math
n = int(input())
li = list(map(int, input().split()))
li.sort()
d = []
for i in range(1, n):
	d += [li[i] - li[i - 1]]
cur = d[0]
sum = d[0]
for i in range(1, n - 1):
	cur = math.gcd(d[i], cur)
	sum += d[i]
print(sum // cur - (n - 1))


from fractions import gcd
n = int(input())
a = input().split()
for i in range(0, n):
	a[i] = int(a[i])
a.sort()
dists = []
for i in range(1, n):
	dists.append(a[i] - a[i - 1])
s = dists[0]
gdc = dists[0]
for i in range(1, len(dists)):
	gdc = gcd(dists[i], gdc)
	s += dists[i]
print(s // gdc - n + 1)


import fractions
n = int(input())
s = [int(x) for x in input().split()]
s.sort(reverse=True)
nod = abs(s[0] - s[1])
for i in range(1, n):
	delta = abs(s[i] - s[i - 1])
	nod = fractions.gcd(nod, delta)
max_i = s[0]
min_i = s[-1]
print((max_i - min_i) // nod + 1 - n)


def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)
n = int(input())
s = []
s = list(map(int, input().split()))
s.sort()
g = 0
for i in range(1, n):
	g = gcd(g, s[i] - s[i - 1])
ans = 0
for i in range(1, n):
	ans += (s[i] - s[i - 1]) / g - 1
print(int(ans))


import math
n = int(input())
v = [int(x) for x in input().split()]
v.sort()
d = [0 for i in range(n - 1)]
for i in range(1, n):
	d[i - 1] = v[i] - v[i - 1]
g = d[0]
for i in d:
	g = math.gcd(g, i)
ans = 0
for i in d:
	ans += i / g - 1
print(int(ans))


def f(a, b):
	while a and b:
		if a < b:
			b = b % a
		else:
			a = a % b
	return a + b
n = int(input())
List = []
for i in range(n):
	List.append(0)
i = 0
for s in input().split(' '):
	List[i] = int(s)
	i = i + 1
List.sort()
if not n - 1:
	print(0)
else:
	kek = List[1] - List[0]
	for i in range(n - 2):
		kek = f(kek, List[i + 2] - List[i + 1])
	ans = (List[n - 1] - List[0]) / kek + 1 - n
	print(int(ans))


import math
str = input()
n = int(str)
a = list(map(int, input().split()))
a.sort()
j = -1
for i in range(0, n - 1):
	a[i] = abs(a[i] - a[i + 1])
	if j == -1:
		j = a[i]
	else:
		j = math.gcd(j, a[i])
sum = 0
for i in range(0, n - 1):
	sum = sum + (a[i] // j - 1)
print(sum)


import sys
import math
n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
A.sort()
x = A[1] - A[0]
for i in range(1, n):
	x = math.gcd(x, A[i] - A[i - 1])
cnt = 0
for i in range(1, n):
	cnt += (A[i] - A[i - 1]) // x - 1
print(cnt)


import sys
import math
from collections import defaultdict, deque
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
arr.sort()
x = arr[1] - arr[0]
for i in range(n - 1):
	x = math.gcd(x, arr[i + 1] - arr[i])
ans = 0
for i in range(n - 1):
	dis = arr[i + 1] - arr[i]
	y = dis // x - 1
	ans += y
print(ans)


import math
n = int(input())
x = list(map(int, input().split()))
x.sort()
for i in range(n - 1, -1, -1):
	x[i] = x[i] - x[0]
ans = 0
for i in range(0, n):
	ans = math.gcd(int(x[i]), int(ans))
print(int(x[n - 1] / ans) + 1 - n)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
p = list(map(int, input().split()))
mx = p[0]
mn = p[0]
for i in p:
	mx = max(mx, i)
	mn = min(mn, i)
for i in range(len(p)):
	p[i] -= mn
mx -= mn
d = mx
for i in p:
	d = gcd(int(i), d)
print(mx // d - n + 1)


n = int(input())
m = list(map(int, input().split()))
m.sort()
min_dif = m[1] - m[0]

def nod(a, b):
	if b == 0:
		return a
	else:
		return nod(b, a % b)
for i in range(1, n):
	min_dif = nod(min_dif, m[i] - m[i - 1])
ans = 0
for i in range(1, n):
	if m[i] - m[i - 1] > min_dif:
		ans += (m[i] - m[i - 1]) / min_dif - 1
print(int(ans))


from sys import stdin, stdout
import sys
import random
import datetime
endl = '\n'

class Scan:

	def __init__(self):
		self.read = stdin.read
		self.input = stdin.readline

	def integer(self, count=1):
		if count == 1:
			return self._integer()
		return [self._integer() for _ in range(count)]

	def _integer(self):
		sym: str = self.read(1)
		while sym != '-' and (not sym.isdigit()):
			sym = self.read(1)
		(number, sign) = (0, -1) if sym == '-' else (int(sym), 1)
		sym: str = self.read(1)
		while sym.isdigit():
			number = number * 10 + int(sym)
			sym = self.read(1)
		return number * sign

	def array(self, func=int, sep=' '):
		if func == str:
			return input().split(sep)
		return list(map(func, input().split(sep)))

	def string(self, count=1):
		if count == 1:
			return self._string()
		return [self._string() for _ in range(count)]

	def _string(self):
		sym = self.read(1)
		while sym in ('\n', '\r', ' '):
			sym = self.read(1)
		s = str()
		while sym not in ('\n', '\r', ' '):
			s += sym
			sym = self.read(1)
		return s

class Write:

	def __lshift__(self, other):
		stdout.write(str(other))
		return self

class Number:

	def gcd(a, b):
		while b > 0:
			(a, b) = (b, a % b)
		return a

	def lcm(a, b):
		return a * b // gcd(a, b)

	def sqrt(n):
		sqrt_n = int(n ** 0.5)
		while sqrt_n * sqrt_n < n:
			sqrt_n += 1
		while sqrt_n * sqrt_n > n:
			sqrt_n -= 1
		return sqrt_n

	def sum_n(n):
		return n * (n + 1) // 2

class Constants:
	EPS = 10 ** (-9)
	INF = 10 ** 18
	MOD = 10 ** 9 + 7

def solution(scan: Scan, write: Write):
	n = scan.integer()
	a = scan.array()
	gcd = 0
	ans = 0
	a.sort()
	for i in range(1, n):
		gcd = Number.gcd(gcd, a[i] - a[i - 1])
	gcd = abs(gcd)
	for i in range(1, n):
		ans += (a[i] - a[i - 1]) // gcd - 1
	print(ans)

def main():
	queries: int = 1
	(scan, write) = (Scan(), Write())
	for _ in range(queries):
		solution(scan, write)
main()


(n, x) = (int(input()), [int(i) for i in input().split()])
(mini, maxi) = (min(x), max(x))
for i in range(n):
	x[i] = x[i] - mini
maxi = maxi - mini
mini = 0

def gcd(a, b):
	y = min(a, b)
	z = max(a, b)
	if y == 0:
		return z
	else:
		return gcd(y, z % y)

def GCD(x):
	res = gcd(x[0], x[1])
	for i in range(n - 2):
		res = gcd(res, x[i + 2])
	return res
a = GCD(x)
print(int(maxi / a) + 1 - n)


from fractions import gcd
n = int(input())
a = sorted(list(map(int, input().split())))
nowgcd = a[1] - a[0]
ans = 0
for i in range(2, n):
	diff = a[i] - a[i - 1]
	nowgcd = gcd(nowgcd, diff)
for i in range(1, n):
	ans += (a[i] - a[i - 1]) // nowgcd - 1
print(ans)


from fractions import gcd
from functools import reduce
n = int(input())
x = list(map(int, input().split()))
x.sort()
difs = []
for i in range(len(x) - 1):
	difs.append(x[i + 1] - x[i])
dif = reduce(gcd, difs)
mmin = x[0]
mmax = x[-1]
x = set(x)
cnt = (mmax - mmin + dif) // dif - n
print(cnt)


def nod(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
n = int(input())
a = list(map(int, input().split()))
a.sort()
d = nod(a[1] - a[0], a[2] - a[1])
for i in range(2, n - 1):
	d = nod(a[i + 1] - a[i], d)
count = 0
for i in range(n - 1):
	count += (a[i + 1] - a[i]) // d - 1
print(count)


from math import gcd
import sys

def input():
	return sys.stdin.buffer.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
a.sort()
g = 0
for i in range(1, n):
	g = gcd(g, a[i] - a[i - 1])
ans = sum(((a[i] - a[i - 1]) // g - 1 for i in range(1, n)))
print(ans)


from math import gcd
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
g = 0
for i in a:
	g = gcd(g, i - a[0])
print((a[-1] - a[0]) // g - n + 1)


def nod(n, m):
	if m == 0:
		return n
	if n > m:
		return nod(m, n % m)
	else:
		return nod(n, m % n)
n = input()
x = sorted(list(map(int, input().split())))
m = min(x)
nnod = 0
for i in range(len(x)):
	if i > 1:
		if i == 2:
			nnod = nod(x[i] - x[i - 1], x[i - 1] - x[i - 2])
		else:
			nnod = nod(nnod, x[i] - x[i - 1])
res = 0
for i in range(len(x)):
	if i > 0:
		res += (x[i] - x[i - 1]) / nnod - 1
print(int(res))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
mas = []
n = int(input())
i = 0
mase = input().split()
while i < n:
	mas.append(int(mase[i]))
	i += 1
mas.sort()
i = 0
raz = []
while i < n - 1:
	raz.append(int(mas[i + 1]) - int(mas[i]))
	i += 1
raz.sort()
a = raz[0]
i = 0
while i < n - 1:
	a = gcd(a, raz[i])
	i += 1
i = 0
ans = 0
while i < n - 1:
	ans += raz[i] / a - 1
	i += 1
print(int(ans))