program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var   i,j,n:integer;
      s,s1:string;
      lensum,lenpref:integer;
function min(a,b:integer):integer;
begin
  if a<b then min:=a else min:=b;
end;
begin
  assign(input,'input.txt');
  reset(input);
  assign(output,'output.txt');
  Rewrite(Output);
  readln(n);
  readln(s);
  lensum:=length(s);
  for i:=2 to N do begin
    readln(s1);lenpref:=0;
    for j:=1 to min(length(s),length(s1)) do
      if s[j]=s1[j] then inc(lenpref) else break;
    lensum:=lensum+length(s1)-lenpref+1;
    s:=s1;
  end;
  writeln(lensum);
  Close(Input);
  Close(Output);
end.
