#include <bits/stdc++.h>
using namespace std;
char buf[1048576];
int main() {
  int n;
  scanf("%d", &n);
  int totlen = 0;
  map<string, int> ids;
  vector<int> id_to_len;
  vector<int> words;
  totlen += n - 1;
  for (int i = 0; i < n; i++) {
    scanf("%s", buf);
    string w = buf;
    totlen += w.length();
    auto I = ids.find(w);
    if (I != ids.end()) {
      words.emplace_back(I->second);
    } else {
      int newid = ids.size();
      ids[w] = newid;
      id_to_len.emplace_back(w.length());
      words.emplace_back(newid);
    }
  }
  int ans = totlen;
  map<vector<int>, pair<int, int>> savemap;
  for (int i = 0; i < n; i++) {
    int save = -1;
    vector<int> cmap;
    for (int j = i; j < n; j++) {
      cmap.push_back(words[j]);
      save += id_to_len[words[j]];
      auto &lis = savemap[cmap];
      if (lis.first == 0) {
        lis.first = 1;
        lis.second = j;
      } else {
        if (lis.second < i) {
          lis.first++;
          lis.second = j;
        }
      }
      int cnt = lis.first;
      if (cnt >= 2) {
        ans = min(ans, totlen - cnt * save);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
