#include <iostream>
using namespace std;
int v[1005], x, n, i, s1, s;
int main()
{
cin >> n;
cin >> v[1];
x = v[1];
s1 = 0;
while(x != 0)
{
s1 = s1 + x % 10;
x = x / 10;
}
for(i = 2; i <= n; i ++)
{
cin >> v[i];
x = v[i];
s = 0;
while(x != 0)
{
s = s + x % 10;
x = x / 10;
}
if(s1 == s) cout << v[i] << " ";
}
return 0;
}