#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  while (y) {
    if (x < y) swap(x, y);
    int tmp = x;
    x = y;
    y = tmp % y;
  }
  return x;
}
int main(void) {
  int n;
  cin >> n;
  int s[n];
  int a;
  cin >> a;
  s[0] = a;
  int g = a, m = a;
  for (int i = 1; i < n; i++) {
    cin >> a;
    s[i] = a;
    g = gcd(g, a);
    m = m * a / g;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (m - 1) % s[i];
  }
  cout << ans << endl;
}
