N=int(input())
a=input().split()
cnt=0
for i in range(N):
a[i]=int(a[i])
if a[i]!=max(a): cnt+=a[i]
print(cnt)