#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;

int main()
{
	long N;
	scanf("%ld", &N);
	char str[N][11];
	long i = 0;
	while (i < N)
		scanf("%s", str[i++]);
	long n = 0;
	qsort(str, N, 11, strcmp);
	i = 0;
	while (i < N - 1)
	{
		printf("%s ", str[i]);
		if (strcmp(str[i], str[i + 1]) != 0)
			n++;
		i++;
	}
	printf("%ld", n);
	return (0);
}