require'prime'; DP = [ ]; class Integer def compute n = self; div = n.prime_division.map{|(p,i)| [p] * i}.flatten; rounds_last = 1; rounds = 0; while n > 1 last_pr = div.pop; rounds += rounds_last; rounds_last *= last_pr; n /= last_pr; end rounds += rounds_last; rounds; end end n = gets.to_i; a = gets.split.map &:to_i; p a.reduce(0){|m,v| m + v.compute};