import Control.Applicative

main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine :: IO [Integer]


  print $ sum $ map (\a -> (lcm' as - 1) `mod` a) as

  where
    gcd' (x:[]) = x
    gcd' (x:xs) = gcd x (gcd' xs)

    lcm' xs = (foldl (*) 1 xs) `div` (gcd' xs)
