using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; class Solution { private static List Get(ulong a) { List Div = new List(); ulong p = 2; ulong n = a; while (n > 1 && p <= n) { while (n % p == 0) { Div.Add(p); n = n / p; } p++; } return Div; } static void Main(String[] args) { DateTime d1 = DateTime.Now; try { string h1 = Console.ReadLine(); h1 = Console.ReadLine(); List Bars = h1.Split(' ').Select(x => ulong.Parse(x)).ToList(); ulong Count = 0; foreach (ulong a in Bars) { List Fac = Get(a).OrderByDescending(x => x).ToList(); ulong pieces = 1; ulong weight = 0; ulong value = a; for (int i = 0; i <= Fac.Count(); i++) { if (value != 1) { value /= Fac[i]; weight += 1 * pieces; pieces *= Fac[i]; } else { weight += 1 * pieces; } } Count += weight; } Console.WriteLine(Count.ToString()); } catch (Exception exception) { Console.WriteLine( exception.Message); } } }