program f;

{$APPTYPE CONSOLE}

uses math;
var inf,outf:text;
 n,i,k,j:integer;
 qq:array[1..10000] of string;
 count:int64;
 a:boolean;
begin
assign(inf,'Input.txt');
assign(outf,'Output.txt');
reset(inf);
rewrite(outf);
 readln(inf,n);
 for i:=1 to n do readln(inf,qq[i]);

 count:=length(qq[1]);


 for i:=2 to n do
 begin

  if qq[i-1]=qq[i] then inc(count,1)

  else
  begin
   a:=false;
    for k:=1 to min(length(qq[i-1]),length(qq[i])) do
    begin
     if qq[i-1][k]<>qq[i][k] then begin inc(count,length(qq[i])-k+2);a :=true; break end;
    end;

   if not a then
   begin
   if length(qq[i-1])>length(qq[i]) then inc (count)
   else inc(count,1+length(qq[i])-length(qq[i-1]));
   end;
  end;

 end;

write(outf,count);
close(inf);
close(outf);
end.
