{$apptype console}

uses Math;

var
  i, len, n: integer;
  a: array[1..10000] of string;

function prefix(x: integer): integer;
var
  i, m, p: integer;
  a1, a2: string;
  b: boolean;
begin
  a1 := a[x];
  a2 := a[x + 1];
  p := 0;
  m := min(length(a1), length(a2));
  b := true;

  for i := 1 to m do
    if a1[i] <> a2[i] then begin
      p := i - 1;
      b := false;
      break;
    end;

  if b then p := m;

  prefix := p;
end;

begin
  assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output);

  readln(n);
  for i := 1 to n do readln(a[i]);

  len := length(a[1]);
  for i := 1 to n - 1 do
    inc(len, length(a[i + 1]) - prefix(i) + 1);

  write(len);

  close(input);
  close(output);
end.