Program fruit;
Type
sc=array [1..231] of integer;
Var
o,x,i,j,n,t:integer;
s:sc;
f1,f2:text;
Begin
assign(f1,'fruit.in');
assign(f2,'fruit.out');
reset(f1);
rewrite(f2);
readln(f1,n);
t:=0; o:=0;
for i:=1 to 231 do s[i]:=0;
for i:=1 to n do begin
read(f1,x);
s[x]:=1;
end;
for i:=1 to 231 do begin
if s[i]=1 then begin
if o>1 then t:=t+(t+i)
else begin
t:=t+i;
o:=o+1;
end;
end;
end;
write(f2,t);
close(f1);
close(f2);
End.