#include <bits/stdc++.h>
using namespace std;
string str[30100];
int n, i;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> str[i];
  for (int i = 0; i < str[0].size(); i++)
    for (int j = 1; j < n; j++)
      if (str[j][i] != str[0][i]) cout << i, exit(0);
  return 0;
}
