#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
const int maxn = 10002;
set<int>sss;
int main()
{
int n, x;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x;
int sum = 0;
while (x != 0)
{
sum+=x % 10;
x /= 10;
}
sss.insert(sum);
}
cout << sss.size() << endl;
for (auto it = sss.begin(); it != sss.end(); it++)
{
if (it != sss.begin()) cout << " ";
cout << *it;
}
}