#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ss;
  long n, m, nn, mm;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n - 1; i++) {
    long ii = 0;
    cin >> ss;
    while (s[ii] == ss[ii]) ii++;
    s[ii] = 0;
  }
  int i = 0;
  while (s[i]) i++;
  cout << i;
  return 0;
}
