#include <bits/stdc++.h>
int main() {
  int i = 0, j = 0;
  int N, f = 0, maxf = 0;
  scanf("%d", &N);
  int A[N];
  for (i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
  }
  for (j = 0; j < 1000000; ++j) {
    f = 0;
    for (i = 0; i < N; ++i) {
      f += j % A[i];
    }
    if (f > maxf) {
      maxf = f;
    }
  }
  printf("%d", maxf);
  return 0;
}
