#include <bits/stdc++.h>
using namespace std;
char ss[22];
string s[30030];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%s", ss), s[i] = ss;
  int len = strlen(ss);
  string temp = "";
  for (int i = 0; i < len; ++i) {
    temp.push_back(ss[i]);
    bool flag = true;
    for (int j = 0; j < n; ++j)
      if (s[j].find(temp) != 0) {
        flag = false;
        break;
      }
    if (!flag) {
      cout << i << endl;
      return 0;
    }
  }
  cout << len << endl;
  return 0;
}
