#include <bits/stdc++.h>
int min(int a[], int n) {
  int l = 1;
  for (int i = 1; i <= n; i++) {
    if (a[l] > a[i]) l = i;
  }
  int t = a[1];
  a[1] = a[l];
  a[l] = t;
}
int main() {
  int n;
  scanf("%d", &n);
  int a[3000 + 5];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  min(a, n);
  long long m[3], m1 = 1;
  for (long long num = a[1] + 1;; num++) {
    long long sum = 0;
    for (int i = 1; i <= n; i++) {
      sum = sum + num % a[i];
    }
    m[m1] = sum;
    if (sum == 0) break;
    m1++;
    if (m1 - 1 == 2) m1 = 1;
  }
  if (m[1] > m[2])
    printf("%lld", m[1]);
  else
    printf("%lld", m[2]);
}
