#include <bits/stdc++.h>
using namespace std;
bool sortit(int a, int b) {
  if (a > b) return 1;
  return 0;
}
int main() {
  int n, i;
  char x[1001];
  int tl[27 * 27] = {0};
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf(" %s", x);
    map<char, int> mp;
    map<char, int>::iterator it;
    for (int j = 0; x[j] != '\0'; j++) mp[x[j]]++;
    if (mp.size() > 2)
      continue;
    else if (mp.size() == 1) {
      it = mp.begin();
      char a = it->first;
      int id = a - 'a' + 1;
      tl[26 * id + id] += it->second;
    } else {
      int c = 0;
      it = mp.begin();
      char a = it->first;
      int id = a - 'a' + 1;
      c += it->second;
      it++;
      char b = it->first;
      int ix = b - 'a' + 1;
      c += it->second;
      tl[26 * id + ix] += c;
    }
  }
  for (i = 1; i <= 26; i++)
    for (int j = 1; j <= 26; j++) {
      if (i != j) tl[min(i, j) * 26 + max(i, j)] += tl[i * 26 + i];
    }
  sort(tl, tl + 27 * 27, sortit);
  printf("%d", tl[0]);
  return 0;
}
