#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string line;
  vector<string> num;
  for (int K = 0; K < N; K++) {
    cin >> line;
    num.push_back(line);
  }
  int t = 0;
  bool con = true;
  while (t < line.length() && con) {
    for (int K = 0; K < N; K++) {
      if (num[K][t] != num[0][t]) {
        con = false;
        break;
      }
    }
    ++t;
  }
  --t;
  cout << t << endl;
  return 0;
}
