using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute; using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions; public static class P { public static void Main() { int n = int.Parse(Console.ReadLine()); var a = Console.ReadLine().Split().Select(long.Parse).ToArray(); long[] sum = new long[100001]; for (int i = 0; i < n; i++) foreach (var div in Divisors(a[i]).Distinct()) sum[div] += a[i] - (a[i] / div); for (int i = 1; ; i <<= 1) { if (a.Any(x => (x & i) != 0)) { Console.WriteLine(a.Sum() - sum.Where((_, ind) => (ind & (i - 1)) == 0).Max()); return; } } } static IEnumerable Divisors(long n) { var max = (int)Ceiling(Sqrt(n)); for (int i = 1; i <= max; i++) if (n % i == 0) { yield return i; yield return n / i; } } }