#include <bits/stdc++.h>
const int N = 3e4 + 10;
const int M = 20 + 5;
int n;
char a[N][M];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", a[i]);
  }
  int lcp = 0;
  for (int i = 0; a[0][i]; ++i) {
    bool equal = true;
    for (int j = 1; j < n; ++j) {
      if (a[j][i] != a[0][i]) {
        equal = false;
      }
    }
    if (!equal) {
      lcp = i;
      break;
    }
  }
  printf("%d\n", lcp);
  return 0;
}
