const int maxn = 30000;
int d[maxn];
int vis[4];
bool ok()
{
repf(i,0,2)
if(vis[i]) return false;
return true;
}
int main()
{
//freopen("in.txt","r",stdin);
int n;
while(cin>>n)
{
int ans = 0;
repf(i,1,n)
{
scanf("%d",&d[i]);
if(n>1 && d[i] == 0) ans++;
}
if(n == 1)
{
cout<<1<<endl;
cout<<d[1]<<endl;
continue;
}
int a = -1;
int b = -1;
int c = -1;
int tag = 0;
repf(i,1,n)
{
repf(j,i+1,n)
{
repf(k,0,2) vis[k] = 1;
if(d[i] == 0 || d[j] == 0) continue;
int t = 3;
int tt = d[i];
while(t > 0)
{
int tmp = tt%10;
tt/=10;
if(tmp == 0)
vis[t - 1] = 0;
t--;
}
tt = d[j];
t = 3;
while(t > 0)
{
int tmp = tt%10;
tt/=10;
if(tmp == 0)
vis[t - 1] = 0;
t--;
}
if(ok())
{
a = d[i];
b = d[j];
tag = 1;
}
}
}
if(tag == 0)
{
if(ans)
{
cout<<2<<endl;
int kk;
repf(i,1,n)
if(d[i] != 0)
kk = d[i];
cout<<0<<" "<<kk<<endl;
}else
{
cout<<1<<endl;
cout<<d[1]<<endl;
}
}else
{
int flag = 0;
//clr(vis)
repf(i,1,n)
repf(j,i+1,n)
repf(k,j+1,n)
{
if(d[i] == 0 || d[j] == 0 || d[k] == 0) continue;
int t = 3;
int tt = d[i];
clr(vis);
while(t > 0)
{
int tmp = tt%10;
tt/=10;
if(tmp)
{
vis[t - 1]++;
}
t--;
}
t = 3;
tt = d[j];
while(t > 0)
{
int tmp = tt%10;
tt/=10;
if(tmp)
vis[t - 1]++;
t--;
}
t = 3;
tt = d[k];
while(t > 0)
{
int tmp = tt%10;
tt/=10;
if(tmp)
vis[t - 1]++;
t--;
}
if(vis[0] == 1&& vis[1] == 1 && vis[2] == 1)
{
a = d[i];
b = d[j];
c = d[k];
flag = 1;
}
}
if(flag)
{
if(ans)
{
cout<<4<<endl;
printf("%d %d %d %d
",0,a,b,c);
}else
{
cout<<3<<endl;
printf("%d %d %d
",a,b,c);
}
}else
{
if(ans)
{
cout<<3<<endl;
printf("%d %d %d
",0,a,b);
}else
{
cout<<2<<endl;
printf("%d %d
",a,b);
}
}
}
}
return 0;
}