program _________f;
 var
     f:text;
     i,j,k,M,N: longint;
     s,s1: string;
     count: longint;
 function min(a,b: longint): longint;
 begin
   if a<b then min:=a else min:=b;
 end;
 function max(a,b: longint): longint;
 begin
   if a>b then max:=a else max:=b;
 end;

 function prefics(as,as1: string): integer;
 var i,ot: integer;
 begin
   ot:=0;
   for i:=1 to min(length(as),length(as1)) do begin
     if as[i]<>as1[i] then break else ot:=i;
   end;
   prefics:=ot;
 end;
 begin
   assign(f,'input.txt');
   reset(f);
   readln(f,n); s:=''; s1:='';
   readln(f,s1);
   count:=length(s1);
   for i:=2 to n do begin
     readln(f,s);
     count:=count+length(s)-prefics(s,s1)+1;
     s1:=s;
   end;
   close(f);

   assign(f,'output.txt');
   rewrite(f);
   write(f,count);
   close(f);
 end.
