using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		long N = long.Parse(str);
		string[] str2 = Console.ReadLine().Split();
		long[] A = new long[N];
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str2[i]);
		}
		long lcma = 1;
		for(var i=0;i<N;i++){
			lcma = Lcm(lcma,A[i]);
		}
		long ans = 0;
		for(var i=0;i<N;i++){
			ans += (lcma -1)% A[i];
		}
		Console.WriteLine(ans);
	}
	
		public static long Lcm(long a, long b) {
            return a * b / Gcd(a, b);
        }
		
		public static long Gcd(long a, long b) {
		if (a < b)
			return Gcd(b, a);
		while (b != 0) {
			var remainder = a % b;
			a = b;
			b = remainder;
		}
		return a;
		}
}