n = gets.to_i
arr = []
n.times{arr << gets.to_i}
max = arr.max
arr2 = []
1.upto(Math.sqrt(max)){|x|
    if max % x == 0
        arr2 << x
        arr2 << max / x if max / x != x
    end
}
arr2.sort!
sum = 0
arr.each{|x|
    z = arr2.bsearch{|y| x <= y}
    sum += z - x
}
puts sum
