#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  int t = 1;
  while (t--) solve();
  return 0;
}
void solve() {
  int n;
  cin >> n;
  vector<string> a;
  for (int i = 0; i < (int)n; i++) {
    string s;
    cin >> s;
    a.push_back(s);
  }
  int len = a[0].size();
  vector<int> check(len, 1);
  for (int i = 0; i < (int)len; i++) {
    for (int j = 1; j < (int)n; j++) {
      if (a[j][i] != a[0][i]) {
        check[i] = 0;
        break;
      }
    }
  }
  (check);
  int lim = 0;
  while (lim < len && check[lim]) lim++;
  cout << lim << "\n";
}
