using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());

            var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            Stack<long> a = new Stack<long>();
            foreach (var x in input) a.Push(x);

            while (a.Count() > 1)
            {
                a.Push(LCMGCD.LCM(a.Pop(), a.Pop()));
            }

            Console.WriteLine(f(a.Peek()-1,input));
        }

        private static long f(long m,long[] a)
        {
            long returnValue = 0;
            foreach (var x in a)
            {
                returnValue += m%x;
            }
            return returnValue;
        }
    }

    public class LCMGCD
    {
        public static long LCM(long m, long n)
        {
            return m / GCD(m, n) * n;
        }

        public static long GCD(long m, long n)
        {
            while (true)
            {
                if (n == 0) return m;
                m %= n;
                if (m == 0) return n;
                n %= m;
            }
        }
    }
}
