#include <bits/stdc++.h>   using namespace std;   bool vis[305][305];   string s[305];   int len[305][305];   int d[305];   int hs[305][305];   int n;   const int mod = 9e8 + 7;   int qpow(int x, int y) {     long long ret = 1;     long long now = x;     while (y) {       if (y & 1) ret = ret * now % mod;       now = now * now % mod;       y >>= 1;     }     return ret;   }   void init() {     memset(vis, false, sizeof(vis));     for (int i = 1; i <= n; i++) {       d[i] = 0;       len[i][0] = s[i].size();       for (int j = 0; j < s[i].size(); j++) {         d[i] = (d[i] * 233LL + s[i][j] -  a  + 1) % mod;       }     }     for (int i = 1; i <= n; i++) {       hs[i][0] = d[i];       for (int j = 1; j + i <= n; j++) {         len[i][j] = len[i + j][0] + len[i][j - 1];         hs[i][j] = (1LL * hs[i][j - 1] * 2333LL + d[i + j]) % mod;       }     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) cin >> s[i];     init();     int ans = 0;     for (int i = 1; i <= n; i++) {       int ls = 0;       for (int j = 0; i + j <= n; j++) {         ls += len[i + j][0];         int nx = i + j + 1;         int cnt = 1;         while (nx + j <= n) {           if (hs[i][j] == hs[nx][j] && len[i][j] == len[nx][j]) {             cnt++;             nx += j + 1;           } else {             nx++;           }         }         if (cnt > 1) ans = max(ans, (ls - 1) * cnt);       }     }     ans = n - 1 - ans;     for (int i = 1; i <= n; i++) ans += len[i][0];     cout << ans << endl;     return 0;   }   