#include <stdio.h>
#include <math.h>

typedef unsigned char       u1;
typedef unsigned short      u2;
typedef unsigned long int   u4;
typedef char                s1;
typedef short               s2;
typedef long int            s4;

#define MIN_NUM (2)
#define MAX_NUM (3000)
#define MIN_A (2)
#define MAX_A (100000)

static u4 a[MAX_NUM];
static u4 aSize;

u4 gcd (u4 a, u4 b) 
{
    u4 c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

u4 lmc (u4 a, u4 b) 
{
    return a * b / gcd(a, b);
}

void main (void) 
{
    u4 i = 0;
    u4 maxF = 0;
    u4 m;
    u4 tmpA;

    // 入力
    scanf("%ld", &aSize);
    for (i = 0; i < aSize; ++i) {
        scanf("%ld", &a[i]);
    }

    // 処理
    tmpA = lmc(a[0], a[1]);
    for (i = 2; i < aSize; ++i) {
        tmpA = lmc(a[i], tmpA);
    }

    m = tmpA - 1;
    for (i = 0; i < aSize; ++i) {
        maxF += (m % a[i]);
    }

    // 出力
    printf("%ld\n", maxF);
}