#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const int mod = 1e9 + 7;
void D(vector<int> a) {
  for (int i : a) cout << i << " ";
  cout << endl;
}
void solve() {
  int n;
  cin >> n;
  vector<string> a;
  for (int i = 0; i < n; i++) {
    string t;
    cin >> t;
    a.push_back(t);
  }
  int c = 0;
  for (int i = 0; i < a[0].size(); i++) {
    char t = a[0][i];
    for (int j = 1; j < n; j++) {
      if (a[j][i] != t) {
        cout << c << endl;
        return;
      }
    }
    c++;
  }
  cout << c << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
