#include <bits/stdc++.h>
using namespace std;
template <typename T>
void dbg(T a) {}
template <typename T, typename... Arg>
void dbg(T a, Arg... arg) {}
const int maxn = (1e6) + 7;
const int maxk = 20;
const int inf = (1e9) + 7;
const long long LLinf = (1e18) + 7;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
vector<int> wek[maxn];
int odl[maxn];
vector<int> q[maxn];
int pref[maxn];
map<string, int> mapa;
string s[maxn];
int tab[maxn];
int dlu[maxn];
void add_edge(int a, int b) {
  wek[a].push_back(b);
  wek[b].push_back(a);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int num = 0;
  int res = 0;
  for (int i = 1; i < 2 * n; i++) {
    if (i & 1)
      cin >> s[i];
    else
      s[i] = " ";
    if (!mapa.count(s[i])) mapa[s[i]] = num++;
    tab[i] = mapa[s[i]];
    res += ((int)(s[i]).size());
    dlu[i] = dlu[i - 1] + ((int)(s[i]).size());
  }
  for (int i = 2 * n; i < 10000; i++) tab[i] = -1;
  int wyn = res;
  for (int i = 1; i < 2 * n; i++) {
    if (tab[i] == 1) i++;
    for (int j = 1; j < 2 * n; j++) {
      pref[j] = 0;
      while (j + pref[j] < 2 * n && tab[j + pref[j]] == tab[i + pref[j]])
        pref[j]++;
      while (pref[j] > 0 && tab[j + pref[j] - 1] == 1) pref[j]--;
      pref[j] = min(pref[j], 2 * n - j);
    }
    for (int dl = 1; dl < 2 * n; dl++) {
      if (dl % 2 == 0) continue;
      int licz = 0;
      for (int j = i; j < i + dl; j++)
        if (j & 1) licz++;
      int ile = 0;
      for (int j = i; j < 2 * n;) {
        if (pref[j] >= dl && tab[j] != 1) {
          ile++;
          j += dl;
        } else
          j++;
      }
      if (ile > 1) {
        wyn = min(wyn, res + ile * (licz - (dlu[i + dl - 1] - dlu[i - 1])));
      }
    }
  }
  cout << wyn;
  return 0;
}
