#include <bits/stdc++.h>
using namespace std;
int m, a[3001], rs;
　long long mt;
　long long zd(　long long a,　long long b) {
  return a % b != 0 ? zd(b, a % b) : b;
}
int main() {
  cin >> m;
  mt = 1;
  for (int i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    mt = mt / (mt > a[i] ? zd(mt, a[i]) : zd(a[i], mt)) * a[i];
  }
  mt--;
  rs = 0;
  for (int i = 0; i < m; i++) rs += mt % a[i];
  cout << rs << endl;
}
