var n,i,d,j,w:longint; max,u,tong:int64; p:array [0..1000000] of boolean; h,k:array [0..1000000] of int64; procedure sieve(n:longint); begin fillchar(p, sizeof(p), true); for i:=2 to n do if (p[i]) then begin j:=i+i; while (j<=n) do begin p[j]:=false; j:=j+i; end; end; end; function kt(u:int64):boolean; var i:longint; begin for i:=1 to d do if sqrt(u)>=h[i] then begin if u mod h[i] = 0 then exit(false); end else exit(true); exit(true); end; begin //assign(input,'test.inp');reset(input); //assign(output,'test.out');rewrite(output); read(n); sieve(1000000); for i:=2 to 1000000 do if p[i] then begin inc(d); h[d]:=i; end; for i:=1 to n do begin read(u); if u=1 then tong:=tong+1 else if kt(u) then tong:=tong+u+1 else begin max:=max+u; w:=1; repeat for j:=w to d do begin if h[j]<=sqrt(u) then begin if u mod h[j]=0 then begin max:=max+u div h[j]; u:=u div h[j]; w:=j; break; end; end else begin u:=1; break; end; end; until u<=1; tong:=tong+max+1; max:=0; end; end; write(tong); end.