#include <bits/stdc++.h>
using namespace std;
void readline(int N, vector<int> &a) {
  string s;
  for (int i = 0; i < N - 1; i++) {
    getline(cin, s, ' ');
    a[i] = atoi(s.c_str());
  }
  getline(cin, s, '\n');
  a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a) {
  string s;
  for (int i = 0; i < N - 1; i++) {
    getline(cin, s, ' ');
    a[i] = atof(s.c_str());
  }
  getline(cin, s, '\n');
  a[N - 1] = atof(s.c_str());
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  readline(N, A);
  long long x = (long long)A[0];
  for (int i = 1; i < N; i++) {
    x /= gcd(x, (long long)A[i]);
    x *= (long long)A[i];
  }
  x -= 1;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    sum += x % A[i];
  }
  cout << sum;
  return 0;
}
