/*
TASK: family
LANG: C++
*/


#include <iostream>
#include <algorithm>
using namespace std;

int N;

string word[ 1024 ];
int cnt[ 1024 ][ 32 ];
bool can[ 1024 ][ 1024 ];
bool bio[ 1024 ];

#define FORA(i,n) for( int i(0); i < n; ++i )
#define FORC(it,v) for(__typeof((v).begin())it=(v).begin();it!=(v).end();++it)

int size;

int abs( int a ) { return ( a > 0 ) ? a : -a; }

void get( int i ) {
     
    FORC( it, word[i] ) cnt[i][ *it - 'A' ]++;
}

void dfs( int to ) {
    
    if( ! bio[to] ) {
        
        bio[to] = true;
        size++;
        FORA( i, N ) {
            
            if( can[to][i] ) dfs( i );
        }    \
    }
}

inline bool isFamily( int f, int s ) {
    
    if( word[f].size() != word[s].size() ) return false;
    
    int diff = 0;
    
    FORA( i, 26 ) {
        
        diff += abs( cnt[f][i] - cnt[s][i] );
        if( diff > 2 ) return false; 
    }
    
    return true;
}

void input() {
     
    cin >> N;
    FORA( i, N ) cin >> word[i]; 
        
}

void solve() { 
    
    int maks = 0;
     
    FORA( i, N ) get( i );
    
    FORA( i, N ) FORA( j, N ) {
       
        if( i != j ) {
            
            can[i][j] = isFamily( i, j );
        }      
    }
    
    FORA( i, N ) {
        
        if( ! bio[i] ) {
            
            size = 0;
            dfs( i );
            maks >?= size;
        }
    }
    
    cout << maks << endl;
}


int main() {
    
    input();
    solve();
    
    return 0;
}
