#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string number[n];
  for (int i = 0; i < n; i++) {
    cin >> number[i];
  }
  int count = 0;
  for (int i = 0; i < number[0].size(); i++) {
    char c = number[0][i];
    int j = 1;
    for (j = 1; j < n; j++) {
      if (number[j][i] != c) {
        break;
      }
    }
    if (j < n) {
      break;
    } else {
      count++;
    }
  }
  cout << count;
}
