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

            int LowestCommonMultiple = 1;
            int GreatestCommonFactor = 0;

            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:;
            }
            
            for(int i =0; i < a.Count; i++)
            {
                LowestCommonMultiple *= a[i];
            }

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