n = int(input()) s = list(map(int,input().split())) sm = 0 for i in range(n): sm = sm+s[i] sm = sm-min(s) print(sm)