#include <bits/stdc++.h>
int main() {
  int i, j, n;
  int cc;
  char pc[21];
  char last[21];
  scanf("%d", &n);
  scanf("%s", last);
  cc = strlen(last);
  for (i = 2; i <= n; i++) {
    scanf("%s", pc);
    for (j = 0; j < cc; j++) {
      if (pc[j] != last[j]) {
        cc = j;
        break;
      }
    }
  }
  printf("%d\n", cc);
  return (0);
}
