program ffff;

{$APPTYPE CONSOLE}

{ses
  SysUtils;}

var
  stnew, stold:string;
  n, counter, i, j, min, lnew:integer;

begin
  assignfile(input, 'input.txt');
  reset(input);

  readln(n);
  readln(stold);
  counter:=length(stold);
  min:=counter;
  for i:=2 to n do
    begin
      readln(stnew);
      lnew:=length(stnew);
      if lnew<min then
        min:=lnew;
      j:=0;
      while (stnew[j+1]=stold[j+1]) and (j<min) do
        inc(j);
      inc(counter, 1+lnew-j);
      stold:=stnew;
      min:=lnew;
    end;
  assignfile(output, 'output.txt');
  rewrite(output);
  writeln(counter);
  closefile(output);  
end.
