program b;

{$APPTYPE CONSOLE}

uses
  Math,SysUtils;

var
fi,fo:text;
s1,s2,s3:string;
i,n:integer;
num:integer;

function comp(a,b:string):integer;
var
i:integer;
begin
result:=0;
i:=1;
while ((i<=length(a))and(i<=length(b)))and(a[i]=b[i]) do
        i:=i+1;
result:=i-1;
end;

begin
assignfile(fi,'input.txt');
assignfile(fo,'output.txt');
reset(fi);
rewrite(fo);
readln(fi,n);
num:=0;
readln(fi,s1);
num:=num+length(s1);
i:=1;

while (i<n) do
begin
readln(fi,s2);
i:=i+1;
s3:=s2;
delete(s3,1,comp(s1,s2));
//s3:=s3;//inttostr(comp(s1,s2));
num:=num+length(s3)+1;//(length(s2)-(comp(s1,s2)));
s1:=s2;
end;

writeln(fo,num);
closefile(fi);
closefile(fo);
end.
