#include <bits/stdc++.h>
using namespace std;
long long int max_koyakusu(long long int a, long long int b) {
  if (a % b == 0) return b;
  max_koyakusu(b, a % b);
}
int main() {
  int N;
  cin >> N;
  vector<int> nums(N);
  for (int i = 0; i < N; i++) cin >> nums[i];
  sort(nums.begin(), nums.end());
  reverse(nums.begin(), nums.end());
  long long int min_kobaisu = nums[0];
  for (int i = 1; i < N; i++) {
    min_kobaisu =
        (min_kobaisu * nums[i]) / (max_koyakusu(min_kobaisu, nums[i]));
  }
  min_kobaisu--;
  long long int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += (min_kobaisu % nums[i]);
  }
  cout << sum << endl;
}
