n = int(input())
AS = list(map(int,input().split()))

def func(m,AS):
  ans = 0
  for a in AS:
    ans += (m % a)
  return ans
    
  
ans = 0
for i in range(2,10**5+1):
  a = func(i,AS)
  if a > ans:
    ans = a
print(ans)
