#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long n, sz[30001][21], in, ans;
map<string, long long> q;
string k, l;
int main() {
  cin >> n;
  for (long long i = 1; i <= (n); i++) {
    cin >> k;
    in = k.length();
    for (long long j = (0); j < (k.length()); j++) {
      l += k[j];
      q[l]++;
      sz[i][j] = q[l];
    }
    l = "";
  }
  for (long long i = 1; i <= (n); i++) {
    for (long long j = (0); j < (in); j++) {
      if (sz[i][j] == n) ans = j + 1;
    }
  }
  cout << ans;
  fclose(stdin);
  fclose(stdout);
}
