#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8bWFwPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBNQVhMRU4gPSAxMDAwOyAvLyDQvNCw0LrRgdC40LzQsNC70YzQvdCw0Y8g0YHRg9C80LzQsNGA0L3QsNGPINC00LvQuNC90LAg0LLRgdC10YUg0YHRgtGA0L7QugoKc3RydWN0IHZlcnRleCB7CiAgICBtYXAgPGNoYXIsIGludD4gbmV4dDsKICAgIGJvb2wgbGVhZjsKfTsKCmludCBzejsKdmVydGV4IHRyW01BWExFTl07Cgp2b2lkIGluaXRfdHJpZSAoKSB7CiAgICBzeiA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IE1BWExFTjsgKytpKSB7CiAgICAgICAgdHJbaV0ubmV4dC5jbGVhciAoKTsKICAgICAgICB0cltpXS5sZWFmID0gZmFsc2U7CiAgICB9CiAgICBzeisrOwp9Cgp2b2lkIGFkZF9zdHJpbmcgKHN0cmluZyBzKSB7CiAgICBpbnQgdiA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IHMubGVuZ3RoICgpOyArK2kpIHsKICAgICAgICBpZiAoIXRyW3ZdLm5leHQuY291bnQgKHNbaV0pKSB7CiAgICAgICAgICAgIHRyW3ZdLm5leHRbc1tpXV0gPSBzeisrOwogICAgICAgIH0KICAgICAgICB2ID0gdHJbdl0ubmV4dFtzW2ldXTsKICAgIH0KICAgIHRyW3ZdLmxlYWYgPSB0cnVlOwp9CgptYWluICgpIHsKICAgIGludCBuOwogICAgY2luID4+IG47CiAgICBpbml0X3RyaWUoKTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICAgICAgc3RyaW5nIHM7CiAgICAgICAgY2luID4+IHM7CiAgICAgICAgYWRkX3N0cmluZyAocyk7CiAgICB9CiAgICBpbnQgdiA9IDA7CiAgICBpbnQgbGVuID0gMDsKICAgIHdoaWxlICh0clt2XS5uZXh0LnNpemUgKCkgPT0gMSkgewogICAgICAgICsrbGVuOwogICAgICAgIHYgPSB0clt2XS5uZXh0LmJlZ2luICgpIC0+IHNlY29uZDsKICAgIH0KICAgIGNvdXQgPDwgbGVuOwp9Cg==