#include <iostream>
#include<set>
using namespace std;
int getFriendNum(int a) {
int sum = 0;
while (a) {
int b = a % 10;
a = a / 10;
sum += b;
}
return sum;
}
int main()
{
int n;
cin >> n;
set<int> fri;
for (int i = 0;i < n;i++) {
int k;
cin >> k;
int a=getFriendNum(k);
fri.insert(a);
}
cout << fri.size() << endl;
set<int>::iterator it;
for (it = fri.begin();it != fri.end();it++) {
if (it != fri.begin())cout << " ";
cout << *it;
}
return 0;
}