package main import "fmt" import "strconv" func fact(x int) []int { f := []int{} i := 2 for x > 1 { if x % i == 0 { f = append(f, i) x = x / i } else { i++ } } return f } // Get all prime factors of a given number n func PrimeFactors(n int) (pfs []int) { // Get the number of 2s that divide n for n%2 == 0 { pfs = append(pfs, 2) n = n / 2 } // n must be odd at this point. so we can skip one element // (note i = i + 2) for i := 3; i*i <= n; i = i + 2 { // while i divides n, append i and divide n for n%i == 0 { pfs = append(pfs, i) n = n / i } } // This condition is to handle the case when n is a prime number // greater than 2 if n > 2 { pfs = append(pfs, n) } return } func split(x int, primes []int) int { if x == 1 { return 1 } if primes == nil { primes = PrimeFactors(x) } cnt := 0 p := primes[len(primes)-1] cnt += 1 + p * split(x/p, primes[:len(primes)-1]) return cnt } func main() { var w string fmt.Scan(&w) n, _ := strconv.Atoi(w) var cnt int for i := 0; i < n; i++ { fmt.Scan(&w) x, _ := strconv.Atoi(w) cnt += split(x, nil) } fmt.Println(cnt) }