#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int max = 0, count = 0, res = 0;
  for (int i = 1; i <= v[0].size(); i++) {
    string temp = v[0].substr(0, i);
    count = 0;
    for (int j = 0; j < v.size(); j++) {
      if (v[j].substr(0, temp.size()) == temp) count++;
    }
    if (count == n) {
      res = temp.size();
    } else
      break;
  }
  cout << res << endl;
  return 0;
}
