#include <bits/stdc++.h>
int mod_func(int m, int a);
int LCM(int a, int b);
int main() {
  int ans = 0, max = 1;
  int N;
  scanf("%d", &N);
  int A[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  double sum = 0;
  for (int i = 0; i < N - 1; i++) {
    max = LCM(A[i], A[i + 1]);
    sum += (mod_func(max - 1, A[i]) + mod_func(max - 1, A[i + 1])) / 2;
  }
  max = LCM(A[0], A[N - 1]);
  sum += (mod_func(max - 1, A[0]) + mod_func(max - 1, A[N - 1])) / 2;
  printf("%d\n", sum);
  return 0;
}
int mod_func(int m, int a) {
  int ans;
  ans = m % a;
  return ans;
}
int LCM(int a, int b) {
  int x = a * b;
  if (a < b) {
    int temp = a;
    a = b;
    b = temp;
  }
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return x / b;
}
