#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int is;
  bool b = true;
  string str;
  cin >> str;
  int min = 90;
  string str2;
  for (int i = 1; i < n; i++) {
    cin >> str2;
    for (int j = 0; j < str.length(); j++) {
      if (str2[j] != str[j]) {
        is = j;
        if (is < min) min = is;
      }
    }
  }
  cout << min;
  return 0;
}
