program problem_ffff;

{$APPTYPE CONSOLE}
var
 f:TextFile;
 n,i,l,r,l1,l2,min:word;
 a:array[1..10000] of string[255];
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
   l1 := length(a[i-1]);
   l2 := length(a[i]);
   min := l1;
   if l2 < min then min := l2;
   l := 1;
   while (l<= min)and( a[i-1][l] = a[i][l] ) do
      Inc(l);

   dec(l);
   r:=r+1+length(a[i])-l;
  end;


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