program problem_f;

{$APPTYPE CONSOLE}
var
 f:TextFile;
 n,i,l:word;
 r:longword;
 a:array[1..10000] of string;
function minim(a,b:word):word;
 begin
  if a<b then
   minim:=a
  else
   minim:=b;
 end;
begin
 assignfile(f,'input.txt');
 reset(f);
 readln(f,n);
 for i:=1 to n do
  readln(f,a[i]);
 closefile(f);

 r:=length(a[1]);
 for i:=2 to n do
  begin
   l:=0;
   while (l<minim(length(a[i-1]),length(a[i])))and(copy(a[i-1],l+1,1)=copy(a[i],l+1,1)) do
    Inc(l);
   r:=r+1+length(a[i])-l;
  end;


 assignfile(f,'output.txt');
 rewrite(f);
 write(f,r);
 closefile(f);
end.
