#include <bits/stdc++.h>
using namespace std;
int main() {
int n, tmp, a, b, c, d, first = 0;
set<int> fri;
cin >> n;
while(n--){
cin >> tmp;
a = tmp % 10;
b = tmp / 10 % 10;
c = tmp / 10 / 10 % 10;
d = tmp / 10 / 10 / 10;
fri.insert(a + b + c + d);
}
cout << fri.size() << endl;
for(auto f: fri) cout << (first++ ? " " : "") << f;
}