#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MAX_BASE = 300;
const long long MODS[5] = {102345689, 100330201, 100426189, 103113233,
                           101214161};
const int MAX_N = 303;
const int MAX_SUM_LEN = 100005;
bool prime[MAX_BASE + 1];
long long base, mod;
int n;
int wL[MAX_N], wR[MAX_N];
long long basePow[MAX_SUM_LEN], basePowInv[MAX_SUM_LEN];
long long prefHash[MAX_SUM_LEN];
long long binPow(long long a, long long x) {
  if (x == 0) return 1;
  if (x == 1) return a;
  if (x % 2 != 0) return (a * binPow(a, x - 1)) % mod;
  long long halfPow = binPow(a, x / 2);
  return (halfPow * halfPow) % mod;
}
int main() {
  for (int i = 2; i <= MAX_BASE; i++) prime[i] = true;
  for (int i = 2; i * i <= MAX_BASE; i++)
    if (prime[i])
      for (int j = i * i; j <= MAX_BASE; j += i) prime[j] = false;
  vector<long long> possibleBases;
  for (int i = 100; i <= MAX_BASE; i++)
    if (prime[i]) possibleBases.push_back(i);
  mt19937 randGen(time(NULL));
  base = possibleBases[randGen() % possibleBases.size()];
  mod = MODS[randGen() % 5];
  ios::sync_with_stdio(false);
  cin >> n;
  string s;
  getline(cin, s);
  getline(cin, s);
  int currL = 0, currR = 0, currJ = 0;
  for (int i = 1; i < (int)s.length(); i++) {
    if (s[i] == ' ') {
      if (currL != -1) {
        wL[currJ] = currL;
        wR[currJ] = currR;
        currJ++;
        currL = -1;
        currR = -1;
      }
    } else {
      if (currL == -1) currL = i;
      currR = i;
    }
  }
  wL[currJ] = currL;
  wR[currJ] = currR;
  for (int i = 0; i < (int)s.length(); i++) s[i] = s[i] - ' ' + 1;
  basePow[0] = 1;
  for (int i = 1; i < (int)s.length(); i++)
    basePow[i] = (basePow[i - 1] * base) % mod;
  for (int i = 0; i < (int)s.length(); i++)
    basePowInv[i] = binPow(basePow[i], mod - 2);
  for (int i = 0; i < (int)s.length(); i++) {
    if (i != 0) prefHash[i] = prefHash[i - 1];
    prefHash[i] = (prefHash[i] + basePow[i] * s[i]) % mod;
  }
  int result = s.length();
  for (int len = 1; len <= n / 2; len++) {
    map<long long, vector<int>> segmentsByHash;
    for (int i = 0; i <= n - len; i++) {
      long long hash1 =
          prefHash[wR[i + len - 1]] - (i == 0 ? 0 : prefHash[wL[i] - 1]);
      while (hash1 < 0) hash1 += mod;
      hash1 %= mod;
      if (i != 0) hash1 = (hash1 * basePowInv[wL[i]]) % mod;
      segmentsByHash[hash1].push_back(i);
    }
    for (auto& p : segmentsByHash) {
      vector<int> segments;
      for (int i : p.second)
        if (segments.size() == 0 || i >= segments.back() + len)
          segments.push_back(i);
      if (segments.size() < 2) continue;
      int res = (int)s.length() +
                (int)segments.size() *
                    (len - wR[segments[0] + len - 1] + wL[segments[0]] - 1);
      result = min(result, res);
    }
  }
  cout << result << endl;
}
