#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
char word[MAXN];
int cnt[105][26];
int n;
int Search(int a, int b) {
  int ct = 0;
  for (int i = 0; i < n; i++) {
    int j;
    for (j = 0; j < 26; j++) {
      if (cnt[i][j] && j != a && j != b) break;
    }
    if (j < 26) continue;
    ct += cnt[i][a] + cnt[i][b];
  }
  return ct;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    int ans = 0;
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < n; i++) {
      scanf("%s", word);
      for (int j = 0; word[j] != '\0'; j++) cnt[i][word[j] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      for (int j = i + 1; j < 26; j++) {
        int tmp = Search(i, j);
        if (tmp > ans) ans = tmp;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
