#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  int cukup = 0;
  for (int i = 0; i < v[0].length(); i++) {
    for (int j = 1; j < v.size(); j++) {
      if (v[j][i] != v[0][i]) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << v[0].length() << endl;
  return 0;
}
