#include <bits/stdc++.h>
using namespace std;
unsigned long long gcm(int a, int b) {
  unsigned long long result = a;
  unsigned long long k = 0;
  unsigned long long n = b;
  do {
    k = result % n;
    result = n;
    n = k;
  } while (k != 0);
  return result;
}
unsigned long long lcm(int a, int b) {
  unsigned long long g;
  g = gcm(a, b);
  return (a * b) / g;
}
unsigned long long lcm_n(vector<int> &numbers) {
  unsigned long long l;
  l = numbers[0];
  for (int i = 1; i < numbers.size(); i++) {
    l = lcm(l, numbers[i]);
  }
  return l;
}
unsigned long long calc(int m, vector<int> a) {
  unsigned long long sum = 0;
  for (size_t i = 0; i < a.size(); i++) {
    sum += m % a[i];
  }
  return sum;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m, n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int tmp, max = 0;
  for (m = 1; m < 1000000; m++) {
    tmp = calc(m, a);
    if (max < tmp) max = tmp;
  }
  cout << max << '\n';
  return 0;
}
