#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


//#define int ll

unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

int dp[15][1 << 15];

queue<tuple<int, int, int>> nexter[300];

pair<int, int> going[15][15];

void solve() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) return;
        vector<string> inputs(n);
        REP(i, n) {
            cin >> inputs[i];
        }
        REP(i, inputs.size()) {
            int ok = 0;
            REP(q, inputs.size()) {
                if (inputs[i].length() >= inputs[q].length()) continue;
                REP(j, inputs[q].length() - inputs[i].length() + 1) {
                    int bo = 1;
                    REP(p, inputs[i].length()) {
                        if (inputs[i][p] != inputs[q][j + p]) {
                            bo = 0;
                            break;
                        }
                    }
                    if (bo == 0) continue;
                    ok = 1;
                    break;
                }
                if (ok == 1) break;
            }
            if (ok == 0) continue;
            inputs.erase(inputs.begin() + i);
            i--;
        }
        inputs.insert(inputs.begin(), "");
        n = inputs.size();
        REP(i, n) {
            REP(q, (1 << n)) {
                dp[i][q] = 1e9;
            }
        }
        REP(ii, n) {
            REP(qq, n) {
                if (ii == qq) continue;
                string base = inputs[ii];
                int cost = 0;
                for (int q = 0; q <= base.size(); ++q) {
                    int ok = 1;
                    for (int j = 0; j < inputs[qq].size() && q + j < base.size(); ++j) {
                        if (inputs[qq][j] != base[q + j]) {
                            ok = 0;
                            break;
                        }
                    }
                    if (ok == 0) continue;
                    for (int j = 0; j < inputs[qq].size(); ++j) {
                        if (q + j >= base.size()) {
                            base.push_back(inputs[qq][j]);
                            cost++;
                        }
                    }
                    break;
                }
                int target = 0;
                REP(q, n) {
                    REP(j, (int)base.length() - (int)inputs[q].length() + 1) {
                        int ok = 1;
                        REP(t, inputs[q].length()) {
                            if (inputs[q][t] != base[t + j]) {
                                ok = 0;
                                break;
                            }
                        }
                        if (ok == 0) continue;
                        target += (1 << q);
                        break;
                    }
                }
                going[ii][qq] = mp(cost, target);
            }
        }
        int ans = 1e9;
        nexter[0].push(make_tuple(0, 0, 0));
        dp[0][0] = 0;
        REP(tea, 300) {
            while (nexter[tea].empty() == false) {
                tuple<int, int, int> now = nexter[tea].front();
                nexter[tea].pop();
                if (dp[get<1>(now)][get<2>(now)] != get<0>(now)) continue;
                if (get<2>(now) == (1 << n) - 1) {
                    ans = min(ans, get<0>(now));
                    continue;
                }
                REP(i, n) {
                    /*
                    string base = "";
                    if (get<1>(now) != -1) {
                        base = inputs[get<1>(now)];
                    }
                    int cost = get<0>(now);
                    for (int q = 0; q <= base.size(); ++q) {
                        int ok = 1;
                        for (int j = max((int)base.size() - (int)inputs[i].size() - 1,0); j < inputs[i].size() && q + j < base.size(); ++j) {
                            if (inputs[i][j] != base[q + j]) {
                                ok = 0;
                                break;
                            }
                        }
                        if (ok == 0) continue;
                        for (int j = 0; j < inputs[i].size(); ++j) {
                            if (q + j >= base.size()) {
                                base.push_back(inputs[i][j]);
                                cost++;
                            }
                        }
                        break;
                    }
                    int target = get<2>(now) + (1 << i);
                    REP(q, n) {
                        if ((1 << q) & target) continue;
                        REP(j, (int)base.length() - (int)inputs[q].length() + 1) {
                            int ok = 1;
                            REP(t, inputs[q].length()) {
                                if (inputs[q][t] != base[t + j]) {
                                    ok = 0;
                                    break;
                                }
                            }
                            if (ok == 0) continue;
                            target += (1 << q);
                            break;
                        }
                    }
                    */
                    int cost = get<0>(now) + going[get<1>(now)][i].first;
                    int target = (going[get<1>(now)][i].second | get<2>(now));
                    if (dp[i][target] > cost) {
                        dp[i][target] = cost;
                        nexter[cost].push(make_tuple(cost, i, target));
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 6000