    #include <iostream>
    #include<vector>
    #include<algorithm>
    #include<map>
    #include<set>
    #include<string>
    #include<math.h>
    #include<iomanip>
#include<stack>

using namespace std;
int fun(int i,int j,int m,int n,vector<vector<char>>result)
{
    int count=0;
    if(i+1<m&&j-1>=0&&result[i+1][j-1]=='*') count++;
    if(i+1<m&&result[i+1][j]=='*') count++;
    if(i+1<m&&j+1<n&&result[i+1][j+1]=='*') count++;


        if(j-1>=0&&result[i][j-1]=='*') count++;
        if(j+1<n&&result[i][j+1]=='*') count++;



        if(i-1>=0&&j-1>=0&&result[i-1][j-1]=='*') count++;
        if(i-1>=0&&result[i-1][j]=='*') count++;
                if(i-1>=0&&j+1<m&&result[i-1][j+1]=='*') count++;


return count;
}

void dfs(int i,int j,int m,int n,vector<vector<char>>&nums)
{
    for(int ii=-1;ii<=1;ii++)
        for(int jj=-1;jj<=1;jj++)
    {
        if(i+ii>=0&&i+ii<m&&j+jj>=0&&j+jj<n&&nums[i+ii][j+jj]!='W')continue;
        else if(i+ii>=0&&i+ii<m&&j+jj>=0&&j+jj<n&&nums[i+ii][j+jj]=='W'){ nums[i+ii][j+jj]='.';dfs(i+ii,j+jj,m,n,nums);}
    }
}


int dp_x[] = {-1, 0, 1, 0}; //四个方向
int dp_y[] = {0, -1, 0, 1};
int search(int x,int y,vector<vector<int>>&mp,vector<vector<int>>&dp,int m,int n)
{
    if(dp[x][y]) return dp[x][y];
    for(int i=0;i<4;i++)
    {
        int vv_x=x+dp_x[i];
        int vv_y=y+dp_y[i];
        if(vv_x>=0&&vv_x<m&&vv_y>=0&&vv_y<n&&mp[x][y]>mp[vv_x][vv_y])
        {
            dp[x][y]= max(dp[x][y],search(vv_x,vv_y,mp,dp,m,n)+1);
        }
    }
            return dp[x][y];

}
long long zuixiao(long long a,long long b)
{
    return a/__gcd(a,b)*b;
}

int main()
{
      int n;
      cin>>n;
      vector<long long>nums;
      for(int i=0;i<n;i++)
      {
          long long  a;
          cin>>a;
          nums.push_back(a);
      }
      long long g=1;
      for(int i=0;i<n;i++)
      {
         g= zuixiao(g,nums[i]);
      }
      g=g-1;
      int sum=0;
     for(int i=0;i<n;i++)
        sum =sum+g%nums[i];
      cout<<sum;
}
