#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int a[100], b[100];
int n;
string convert_to_str(int k) {
  string s = "000";
  int i = 2;
  while (k) {
    if (k % 10 != 0) s[i] = '1';
    k /= 10;
    i--;
  }
  return s;
}
void alg(int k) {
  string s = convert_to_str(k);
  if (s == "000") {
    a[1]++;
    b[1] = k;
  }
  if (s == "001") {
    b[2] = k;
    a[2]++;
  }
  if (s == "010") {
    b[3] = k;
    a[3]++;
  }
  if (s == "100") {
    b[4] = k;
    a[4]++;
  }
  if (s == "011") {
    a[5]++;
    b[5] = k;
  }
  if (s == "101") {
    a[6]++;
    b[6] = k;
  }
  if (s == "110") {
    b[7] = k;
    a[7]++;
  }
  if (s == "111") {
    a[8]++;
    b[8] = k;
  }
}
bool no_trouble(int k) {
  string s = convert_to_str(k);
  for (int i = 0; i < v.size(); i++) {
    string s1 = convert_to_str(v[i]);
    for (int j = 0; j < 3; j++)
      if (s[j] + s1[j] - '0' - '0' > 1) {
        return false;
      }
  }
  return true;
}
void show() {
  int ans = 0;
  for (int i = 1; i <= 4; i++)
    if (a[i]) {
      ans++;
      v.push_back(b[i]);
    }
  bool temp = true;
  for (int i = 5; i <= 8; i++)
    if (a[i] && no_trouble(b[i])) {
      ans++;
      v.push_back(b[i]);
    }
  if (n != 1) {
    cout << ans << endl;
    for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int f;
    cin >> f;
    if (n == 1) cout << 1 << endl << f;
    alg(f);
  }
  show();
  return 0;
}
