def main(arr, n):
	
	m = max(arr)
	f = 0
	cont = 0
	
	for i in range(m**2):
		cont = 0
		for a in arr:
			cont += i%a
		
		f= max(f, cont)
	
	return f
	

n = int(input())
arr = input().split(" ")
arr = [int(c) for c in arr]
