#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, len, i, j, count = 0;
  char contacts[30001][21], s;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> contacts[i];
  }
  len = strlen(contacts[0]);
  for (i = 0; i < len; ++i) {
    s = contacts[0][i];
    for (int j = 1; j < n; ++j) {
      if (contacts[j][i] != s) {
        cout << count;
        return 0;
      }
    }
    count++;
  }
  return 0;
}
