#include <bits/stdc++.h>
using namespace std;
string s[1013];
int raz(string s1, string s2) {
  int ans = 0;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] != s2[i]) {
      ans++;
    }
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  int mn = 100;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int per = raz(s[i], s[j]);
      if (per < mn) {
        mn = per;
      }
    }
  }
  if (n == 1) {
    cout << 6;
    return 0;
  }
  cout << mn / 2 - (mn + 1) % 2;
}
