output_description: Print the maximum value of f.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 ... a_N
attempt: import math
  
  
  class Sieve:
      """Sieve of Eratosthenes.
  
      List primes up to n.
      """
  
      def __init__(self, n):
          self.__prime = []
          self.__is_prime = [i >= 2 for i in range(n + 1)]
  
          for i in range(2, int(math.sqrt(n)) + 1):
              if self.__is_prime[i]:
                  for j in range(i * i, n + 1, i):
                      self.__is_prime[j] = False
  
          for i in range(2, n + 1):
              if self.__is_prime[i]:
                  self.__prime.append(i)
  
      def prime(self):
          return self.__prime
  
      def is_prime(self, n):
          return self.__is_prime[n]
  
  
  def bf(N, a):
      p = Sieve(max(a) + 1).prime()  # len <= 9952
  
      prime_to_power = {}
      for prime in p:
          prime_to_power[prime] = 0
  
      for i in range(N):
          ai = a[i]
          for prime in p:
              power = 0
              while ai % prime == 0:
                  ai //= prime
                  power += 1
              prime_to_power[prime] = max(prime_to_power[prime], power)
      lcm = 1
      for prime in prime_to_power:
          lcm *= prime ** prime_to_power[prime]
      m = lcm - 1
      ans = 0
      for ai in a:
          ans += m % ai
      return ans
  
  
  def al(N, a):
      return sum(a) - len(a)
  
  
  if __name__ == "__main__":
      N = int(input())  # 2 <= N <= 3000
      a = list(map(int, input().split()))  # 2 <= ai <= 100000
      # print(bf(N, a))
      print(al(N, a))
  
problem_description: Statement
  
  You are given N positive integers a_1, a_2, ..., a_N.
  
  For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... +
  (m\ mod\ a_N).
  
  Here, X\ mod\ Y denotes the remainder of the division of X by Y.
  
  Find the maximum value of f.
samples: [{"input": "3\n    3 4 6", "output": "10\n    \n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value\nof f.\n\n* * *"}, {"input": "5\n    7 46 11 20 11", "output": "90\n    \n\n* * *"}, {"input": "7\n    994 518 941 851 647 2 581", "output": "4527"}]