program f;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  N:Integer;
  A:Array[1..10000] of String;
  I:Integer;
  Answer:Integer;

procedure Doing(var S1,S2:String);
var
 Len,Len1,Max:Integer;
 i:Integer;
Begin
     Len:=Length(S1);Len1:=Length(S2);
     if(Len<Len1)Then Max:=Len Else Max:=Len1;


     for i:=1 to Max Do Begin
         if(S1[i]<>S2[i]) Then Break;
     End;

  Answer:= Answer+Len1-I+2;
End;


Procedure Process;
Begin
    Answer:=Length(A[1]);
    For i:=1 to N-1 Do
          Doing(A[i],A[i+1]);

End;



begin
   AssignFile(Input,'input.txt');
   Reset(Input);
   Readln(N);

   for i:=1 to N Do Begin
       Readln(A[i]);
   End;
   Close(Input);

   Answer:=0;

   Process;

   AssignFile(OutPut,'output.txt');
   Rewrite(output);
   Write(Answer);
   Close(Output);

  { TODO -oUser -cConsole Main : Insert code here }
end.
