input() a=sorted(list(map(int,input().split()))) b=a.pop() while a[len(a)-1]==b: b = a.pop() print(sum(a))