#include <bits/stdc++.h>
int var_of_where_is_debug = 0;
template <typename type>
void print_vector(type d1_arr);
template <typename type>
void print_2dvector(type d2_arr);
std::vector<std::vector<int>> padding(std::vector<std::vector<int>> arr,
                                      int pad);
template <typename type>
void show(type arr);
template <typename type>
void print_map(type map);
inline std::vector<long long> str_int_split(char *s);
inline std::vector<std::vector<long long>> in_d2_arr(int N, int size = 1000);
inline std::vector<long long> in_d1_arr(int size = 1000);
inline double d2_distance(int x1, int y1, int x2, int y2);
inline int d2_manhattan(int x1, int y1, int x2, int y2);
class array {
 public:
  std::vector<long long> arr1;
  std::vector<std::vector<long long>> arr2;
  std::string str1;
  std::vector<std::string> str2;
  array(int, std::string);
  array(int);
  void show();

 private:
  int dimension;
  std::string kind;
};
long long gcm(long a, long b) {
  long long result = a;
  long long k = 0;
  long long n = b;
  do {
    k = result % n;
    result = n;
    n = k;
  } while (k != 0);
  return result;
}
long long lcm(long long a, long long b) {
  long long g;
  g = gcm(a, b);
  return a * b / g;
}
long long lcm_n(std::vector<long long> &numbers) {
  long long l;
  l = numbers[0];
  for (int i = 1; i < numbers.size(); i++) {
    l = lcm(l, numbers[i]);
  }
  return l;
}
int main() {
  array temp(1);
  array nd(1);
  auto g = lcm_n(nd.arr1) - 1;
  long long out = 0;
  for (auto i : nd.arr1) {
    out += g % i;
  }
  std::cout << out << std::endl;
}
array::array(int height) {
  long long size = int(pow(10, 9));
  dimension = height;
  kind = "num";
  if (height == 1) {
    arr1 = in_d1_arr(size);
  } else {
    arr2 = in_d2_arr(height, size);
  }
}
array::array(int height, std::string type) {
  long long size = int(pow(10, 9));
  dimension = height;
  if (type == "long long") {
    kind = "num";
    if (height == 1) {
      arr1 = in_d1_arr(size);
    } else {
      arr2 = in_d2_arr(height, size);
    }
  } else {
    kind = "str";
    if (height == 1) {
      char *temp = new char[1000000000];
      scanf(" %[a-zA-Z (+-0-9_) #.]/n", temp);
      str1 = std::string(temp);
      delete[] temp;
    } else {
      for (int i = 0; i < height; ++i) {
        char *temp = new char[1000000000];
        scanf(" %[a-zA-Z (+-0-9_) #.]/n", temp);
        str2.push_back(std::string(temp));
        delete[] temp;
      }
    }
  }
}
void array::show() {
  if (kind == "num") {
    if (dimension == 1) {
      print_vector(arr1);
    } else {
      print_2dvector(arr2);
    }
  } else {
    if (dimension == 1) {
      std::cout << str1 << std::endl;
    } else {
      for (auto line : str2) {
        std::cout << line << std::endl;
      }
    }
  }
}
template <typename type>
void print_vector(type d1_arr) {
  for (auto seg : d1_arr) {
    std::cout << seg;
    std::cout << " ";
  }
  std::cout << std::endl;
}
template <typename type>
void print_2dvector(type d2_arr) {
  for (auto seg1 : d2_arr) {
    for (auto seg2 : seg1) {
      std::cout << seg2;
      std::cout << " ";
    }
    std::cout << std::endl;
  }
}
template <typename type>
void print_map(type map) {
  for (auto m : map) {
    std::cout << m.first;
    std::cout << ":";
    std::cout << m.second;
    std::cout << " ";
  }
  std::cout << std::endl;
}
std::vector<std::vector<int>> padding(std::vector<std::vector<int>> arr,
                                      int pad) {
  std::vector<std::vector<int>> arr_c = arr;
  int height = arr_c.size();
  int width = arr_c[0].size();
  std::vector<int> v;
  v.resize(width);
  fill(v.begin(), v.end(), pad);
  arr_c.insert(arr_c.begin(), v);
  arr_c.push_back(v);
  int i;
  for ((i) = 0; (i) < (height + 2); ++(i)) {
    arr_c[i].insert(arr_c[i].begin(), pad);
    arr_c[i].resize(width + 2);
  }
  arr_c.shrink_to_fit();
  return arr_c;
}
inline std::vector<long long> str_int_split(char *s) {
  char *tok = strtok(s, " ,");
  std::vector<long long> v;
  while (tok != NULL) {
    v.push_back(atoll(tok));
    tok = strtok(NULL, " ,");
  }
  return v;
}
inline std::vector<std::vector<long long>> in_d2_arr(int N, int size) {
  int i;
  std::vector<std::vector<long long>> v;
  for ((i) = 0; (i) < (N); ++(i)) {
    char *lines;
    lines = new char[size];
    scanf(" %[a-zA-Z (+-0-9_) #.]/n", (lines));
    ;
    v.push_back(str_int_split(lines));
    delete[] lines;
  }
  return v;
}
inline std::vector<long long> in_d1_arr(int size) {
  std::vector<long long> v;
  char *lines;
  lines = new char[size];
  scanf(" %[a-zA-Z (+-0-9_) #.]/n", (lines));
  ;
  v = str_int_split(lines);
  delete[] lines;
  return v;
}
inline double d2_distance(int x1, int y1, int x2, int y2) {
  return sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2));
}
inline int d2_manhattan(int x1, int y1, int x2, int y2) {
  return (abs(x2 - x1) + abs(y2 - y1));
}
