#include <bits/stdc++.h>
using namespace std;
const int mx = 123;
int f[mx][30];
string w[mx];
int main() {
  int n;
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    w[i] = s;
    for (int j = 0; j < int(s.size()); j++) f[i][s[j] - 'a']++;
  }
  int ans = 0;
  for (int i = 0; i < 30; i++) {
    for (int j = 0; j < 30; j++)
      if (i != j) {
        int bet = 0;
        for (int k = 0; k < n; k++) {
          if (f[k][i] + f[k][j] == int(w[k].size())) {
            bet += f[k][i] + f[k][j];
          }
        }
        ans = max(ans, bet);
      }
    int bet = 0;
    for (int k = 0; k < n; k++) {
      if (f[k][i] == int(w[k].size())) {
        bet += f[k][i];
      }
    }
    ans = max(ans, bet);
  }
  printf("%d\n", ans);
  return 0;
}
