program F;

var 
  a, b: string;
  fi, fo: text;
  i, j, t, k, N: integer;
  c: longint;
begin
  readln(N);
  readln(a);
  c := Ord(a[0]);
  for i := 2 to N do begin
    readln(b);
    t := 0;
    k := Ord(a[0]);
    if (k > Ord(b[0])) then k := Ord(b[0]);
    for j := 1 to k do
      if (a[j] = b[j]) then
      	inc(t)
      else
        break;
    inc(c, Ord(b[0]) - t + 1);
    a := b;
  end;
  writeln(c);
end.
