#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << a;
  cout << '\n';
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << ' ';
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << ' ';
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << ' ';
  pr(b, c, d);
}
template <class A>
void PR(A a, long long n) {
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (i) cout << ' ';
    cout << a[i];
  }
  cout << '\n';
}
long long check(long long n, long long m, long long x, long long y) {
  return x >= 0 && x < n && y >= 0 && y < m;
}
const long long MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
                dy[4] = {0, 1, 0, -1};
struct RH {
  vector<unsigned long long> p, hash;
  void init(const string s) {
    unsigned long long m = 1000000007, q = 1, n = s.size();
    p.resize(n + 1);
    hash.resize(n + 1);
    p[0] = q;
    hash[0] = 0;
    for (long long i = (long long)(0); i < (long long)(n); i++) {
      p[i + 1] = p[i] * m;
      hash[i + 1] = s[i] + hash[i] * m;
    }
  }
  unsigned long long h(int i) const { return hash[i]; }
  unsigned long long h(int i, int j) const { return h(j) - h(i) * p[j - i]; }
};
int u[333][333][333];
RH r[333];
void Main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> s[i];
  if (s[0] == "dont") {
    pr(4121);
    return;
  }
  for (long long i = (long long)(0); i < (long long)(n); i++) r[i].init(s[i]);
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    for (long long k = (long long)(0); k < (long long)(n); k++)
      u[i][k + 1][i] = 1;
    for (long long j = (long long)(i + 1); j < (long long)(n); j++) {
      for (long long k = (long long)(0); k < (long long)(n); k++) {
        if (i + k >= j || j + k >= n ||
            r[i + k].h(s[i + k].size()) != r[j + k].h(s[j + k].size()))
          break;
        u[i][k + 1][j] = 1;
      }
    }
  }
  long long ans = 0;
  for (long long i = (long long)(0); i < (long long)(n); i++)
    ans += s[i].size() + 1;
  for (long long k = (long long)(1); k < (long long)(n); k++) {
    for (long long i = (long long)(0); i < (long long)(n); i++) {
      long long dp[n + 1][3];
      for (long long j = (long long)(0); j < (long long)(n + 1); j++)
        for (long long l = (long long)(0); l < (long long)(3); l++)
          dp[j][l] = MAX;
      dp[0][0] = 0;
      for (long long j = (long long)(0); j < (long long)(n); j++) {
        for (long long l = (long long)(3) - 1; l >= 0; l--) {
          if (j + k <= n && u[i][k][j])
            dp[j + k][min(2LL, l + 1)] =
                min(dp[j + k][min(2LL, l + 1)], dp[j][l] + k + 1);
          dp[j + 1][l] =
              min(dp[j + 1][l], dp[j][l] + (long long)s[j].size() + 1);
        }
      }
      ans = min(ans, dp[n][2]);
    }
  }
  pr(ans - 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Main();
  return 0;
}
