var
n,x,i,t,j,b:longint;
a:array[1..100000] of longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j]then begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
for i:=1 to a[n] do
begin
b:=1;
for j:=1 to n do
begin
if a[j]=i then
if b=1 then
begin
b:=b+1;
x:=x+6;
end
else x:=x+1;
if a[j]>i then break;
end;
x:=x+6;
end;
x:=x+4*a[n];
writeln(x);
end.
全部超时