#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000 + 7;
const double esp = 1e-13;
int n, m, ans, a[30000 + 10][30];
bool ok;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> s;
    m = s.length();
    for (long long j = 0; j < m; j++) a[i][j + 1] = s[j] - '0';
  }
  ans = 0;
  for (long long i = 1; i <= m; i++) {
    ok = true;
    for (long long j = 2; j <= n; j++) ok &= (a[j][i] == a[j - 1][i]);
    if (!ok) break;
    ans = i;
  }
  cout << ans;
}
