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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var a = ReadLine().Split(' ').Select(long.Parse).ToArray();

        var m = a.LcmAll() - 1;
        var ans = a.Select(x => m % x).Sum();

        WriteLine(ans);
    }
}

static partial class MathExt
{
    public static int GcdAll(this IEnumerable<int> a) => (int)GcdAll(a.Select(x => (long)x));
    public static long GcdAll(this IEnumerable<long> a) => a.Aggregate((s, e) => Gcd(s, e));
    public static int Gcd(int a, int b) => (int)Gcd((long)a, b);
    public static long Gcd(long a, long b) => (b != 0) ? Gcd(b, a % b) : a;
    public static long LcmAll(this IEnumerable<long> a) => a.Aggregate((s, e) => Lcm(s, e));
    public static long Lcm(long a, long b) => a / Gcd(a, b) * b;
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}
