#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T &t, T f) {
  if (t > f) t = f;
}
template <class T>
void chmax(T &t, T f) {
  if (t < f) t = f;
}
const int INF = 2147483647 / 3;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1, 0};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1, 0};
string str[40000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) cin >> str[i];
  for (int i = 0; i < (((int)(str[0]).size())); ++i) {
    for (int j = 0; j < (n); ++j) {
      if (str[j][i] != str[0][i]) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << ((int)(str[0]).size()) << endl;
  return 0;
}
