using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Versioning; using System.Text; using System.Threading.Tasks; namespace ConsoleApp3 { class Program { static void Main(string[] args) { var scanner = new Scanner(); int N = scanner.NextInt(); long[] A = new long[N]; long[] F = new long[400001]; long total = 0; for (int i = 0; i < N; i++) { A[i] = scanner.NextInt(); F[A[i]]++; total += A[i]; } long[] S = new long[400002]; for (int i = 0; i <= 400000; i++) { S[i + 1] = S[i] + F[i]; } long answer = total * N; for (long i = 1; i <= 200000; i++) { for (long j = 0; i * j <= 200000; j++) { answer -= i * j * (S[i * (j + 1)] - S[i * j]) * F[i]; } } Console.WriteLine(answer); } } class Scanner { int index = 0; string[] tokens = { }; public string Next() { if (index == tokens.Length) { index = 0; tokens = Console.ReadLine().Split(' '); } return tokens[index++]; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } } }