using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.ReadLine();
			var nums = Console.ReadLine().Split(' ').Select(input => decimal.Parse(input));

			decimal commonMultiple = 1;

			foreach (var num in nums)
			{
				commonMultiple = calculateCommonMultiple(commonMultiple, num);
			}
			Console.WriteLine(f(nums, commonMultiple - 1));
		}

		private static decimal calculateCommonMultiple(decimal current, decimal next)
		{
			if (current % next == 0)
			{
				return current;
			}
			if (next % current == 0)
			{
				return next;
			}
			return current * next;
		}

		private static decimal f(IEnumerable<decimal> nums, decimal m) => nums.Sum(num => m % num);
	}
}
