#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

const int MAXLEN = 1000; // максимальная суммарная длина всех строк

struct vertex {
    map <char, int> next;
    bool leaf;
};

int sz;
vertex tr[MAXLEN];

void init_trie () {
    sz = 0;
    for (int i = 0; i < MAXLEN; ++i) {
        tr[i].next.clear ();
        tr[i].leaf = false;
    }
    sz++;
}

void add_string (string s) {
    int v = 0;
    for (int i = 0; i < s.length (); ++i) {
        if (!tr[v].next.count (s[i])) {
            tr[v].next[s[i]] = sz++;
        }
        v = tr[v].next[s[i]];
    }
    tr[v].leaf = true;
}

main () {
    int n;
    cin >> n;
    init_trie();
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        add_string (s);
    }
    int v = 0;
    int len = 0;
    while (tr[v].next.size () == 1) {
        ++len;
        v = tr[v].next.begin () -> second;
    }
    cout << len;
}
