#include <bits/stdc++.h>
using namespace std;
int stringCompare(string s1, string s2) {
  int res = 0;
  if (s1.size() != s2.size()) {
    res = res / res;
  }
  for (int i = 0; i < s1.size(); ++i)
    if (s1[i] != s2[i]) res++;
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; ++i) cin >> s[i];
  int ans = 13;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) ans = min(ans, stringCompare(s[i], s[j]));
  cout << max((ans + 1) / 2 - 1, 0);
  return 0;
}
