using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        string N = Console.ReadLine();
        List<int> a = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

        decimal LowestCommonMultiple = 1;
        int GreatestCommonFactor = 1;

        for (int i = a.Min(); 0 < i; i--)
        {
            for(int j = 0; j < a.Count; j++)
            {
                if(a[j] % i != 0)
                {
                    goto Next;
                }                    
            }
            GreatestCommonFactor = i;
            break;

            Next:;
            if(i == a.Min())
            {
                i /= 2;
                i++;
            }
        }
            
        for(int i = 0; i < a.Count; i++)
        {
            LowestCommonMultiple *= a[i] / GreatestCommonFactor;
        }

        decimal val = 0;
        for(int j = 0; j < a.Count; j++)
        {
            val += (LowestCommonMultiple - (decimal)1) % (decimal)a[j]; 
        }
            
        Console.WriteLine(val);
    }
}

