#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

#define pii pair<int,int>
#define pis pair<int,string>
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define MaxN 5010
#define MaxLen 55

class Trie {
public:

    int sl;
    char c[MaxN*MaxLen];
    int size[MaxN*MaxLen];
    int a[MaxN*MaxLen][26];
    bool mark[MaxN*MaxLen][26];
    int end[MaxN*MaxLen];
    bool pob[MaxN*MaxLen];
    int pobIdx[MaxN*MaxLen];
    int len[MaxN*MaxLen];

    Trie() {
        memset(size, 0, sizeof(size));
        memset(mark, 0, sizeof(mark));
        memset(end, 0, sizeof(end));
    }

    void init() {
        memset(size, 0, sizeof(size));
        memset(mark, 0, sizeof(mark));
        memset(end, 0, sizeof(end));
        c[0] = '!';
        sl = 1;
    }

    void add( int node, int p, char *s, int len )
    {

        if ( p == len ) {
            end[node]++;
            return;
        }

        if ( mark[node][ s[p]-'a' ] ) {
            for (int i = 0; i < size[node]; ++i) {
                if ( c[ a[node][i] ] == s[p] ) {
                    add( a[node][i], p+1, s, len );
                    break;
                }
            }
        }
        else {
            a[node][ size[node]++ ] = sl;
            mark[node][ s[p]-'a' ] = true;

            c[sl] = s[p];
            sl++;
            add( sl-1, p+1, s, len );

        }
    }

    void Sort( int node )
    {
        for (int i = 0; i < size[node]; ++i)
            Sort( a[node][i] );


        for (int i = 0; i < size[node]; ++i) {
            int idx = i;
            for (int j = i+1; j < size[node]; ++j) {
                if ( c[ a[node][idx] ] > c[ a[node][j] ] ) {
                    idx = j;
                }
            }

            int p = a[node][idx];
            a[node][idx] = a[node][i];
            a[node][i] = p;
        }
    }

    int Solve( int node )
    {
        pob[node] = false;
        len[node] = 100;
        int id = -1;

        if ( end[node] == 0 ) {
            for (int i = 0; i < size[node]; ++i) {
                Solve( a[node][i] );

                if ( !pob[ a[node][i] ] ) {
                   pob[node] = true;

                   if ( len[node] > len[ a[node][i] ] ) {
                      id = i;
                      len[node] = len[ a[node][i] ];
                   }
                }
                else {
                    if ( pob[node] ) continue;

                    if ( len[node] < len[ a[node][i] ] || id == -1 ) {
                        id = i;
                        len[node] = len[ a[node][i] ];
                    }
                }
            }
        }

        if ( id != -1 ) {
            pobIdx[node] = id;
            len[node]++;
        }
        else {
            if ( size[node] == 0 || end[node] > 0 ) {
                pobIdx[node] = -1;
                pob[node] = true;
                len[node] = 1;
            }
            else {
                pobIdx[node] = -1;
                len[node] = 100;
            }
        }
    }

    void Ispisi( int node )
    {
        if ( c[node] != '!' ) {
            printf("%c",c[node]);
        }

        if ( pobIdx[node] != -1 ) {
            Ispisi( a[node][ pobIdx[node] ] );
        }
    }


};

char s[MaxLen];
int n;
Trie trie;

int main()
{
    freopen("igra.in","r",stdin);
    freopen("igra.out","w",stdout);

    trie.init();

    scanf("%d",&n);
    for (int i = 0; i < n; ++i) {
        scanf("%s",s);
        trie.add( 0, 0, s, strlen(s) );
    }
    trie.Sort( 0 );
    trie.Solve( 0 );

    printf("%d\n",2-trie.pob[0]);
    trie.Ispisi( 0 );
    printf("\n");

    return 0;
}
