#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=100010;
pair<int,string> p[N];
string s[N];
int n,m;char ch[50];
int main()
{
freopen("gray.in","r",stdin);
freopen("gray.out","w",stdout);
scanf("%d",&n);gets(ch);
for (int i=1;i<=n;i++)
gets(ch),s[i].assign(ch);
sort(s+1,s+n+1);
for (int i=1;i<=n;){
string x=s[i];
int cnt=0;
for (;i<=n&&s[i]==x;i++,cnt--);
if (cnt<-2) p[++m]=make_pair(cnt,x);
}
sort(p+1,p+m+1);
printf("%d\n",m);
for (int i=1;i<=m;i++) puts(p[i].second.c_str());
return 0;
}