#include <bits/stdc++.h>
using namespace std;
const int Max = 222222;
const int MaxL = 22;
char St[Max][MaxL];
map<int, int> mp;
int B[Max];
inline int com(char *s, char *t, int l) {
  if (s == St[0]) return 0;
  for (int k = l; k > 0; k--) {
    char c = t[k];
    t[k] = '\0';
    int r = strcmp(s + l - k, t);
    t[k] = c;
    if (r == 0) return k;
  }
  return 0;
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF && n) {
    scanf("%s", St[1]);
    for (int i = 2; i <= n; i++) scanf("%s", St[i]);
    int len = strlen(St[1]);
    int sS = 0, maxD = 0;
    mp.clear();
    memset(B, -1, sizeof(B[0]) * (n + 1));
    for (int i = 2; i <= n; i++) {
      int r = 0;
      for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
        int x = it->second;
        while (x != -1) {
          int cd = com(St[x], St[i], len);
          r = max(r, it->first + cd);
          x = B[x];
        }
      }
      int d = com(St[i - 1], St[i], len);
      r -= d, sS += d;
      if (r > maxD) {
        for (int i = maxD - len; i < r - len; i++)
          if (mp.find(i) != mp.end()) mp.erase(i);
        maxD = r;
      }
      if (r >= maxD - len) {
        if (mp.find(r) != mp.end()) {
          B[i - 1] = mp[r];
          mp[r] = i - 1;
        } else
          mp.insert(make_pair(r, i - 1));
      }
    }
    printf("%d\n", n * len - maxD - sS);
  }
  return 0;
}
