var
n,a,s,b:longint;
begin
read(n);
for n:=1 to n do begin
read(a);
if (a<b) or (n=1) then b:=a;
s:=s+a
end;
write(s-b)
end.
var
n,a,s,b:longint;
begin
read(n);
for n:=1 to n do begin
read(a);
if (a<b) or (n=1) then b:=a;
s:=s+a
end;
write(s-b)
end.