#include <bits/stdc++.h>
using namespace std;
vector<string> v;
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    char s[50];
    scanf("%s", &s);
    v.push_back((string)s);
  }
  int res = 0;
  while (true) {
    int ok = 1;
    for (int i = 0; i < n; i++)
      if (v[i][res] != v[0][res]) {
        printf("%d\n", res);
        return 0;
      }
    res++;
  }
  printf("%d\n", res);
  return 0;
}
