#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline string toString(T a) {
  ostringstream os("");
  os << a;
  return os.str();
}
template <typename T>
inline long long toLong(T a) {
  long long res;
  istringstream os(a);
  os >> res;
  return res;
}
template <typename T>
inline T SQ(T a) {
  return a * a;
}
template <typename T>
inline T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
inline unsigned long long bigmod(T a, T b, T m) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return S(bigmod(a, b / 2, m)) % m;
  else
    return (a % m * bigmod(a, b - 1, m)) % m;
}
template <typename T>
inline vector<string> parse(T str) {
  vector<string> res;
  string s;
  istringstream os(str);
  while (os >> s) res.push_back(s);
  return res;
}
template <typename T>
inline unsigned long long dist(T A, T B) {
  unsigned long long res =
      (A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y);
  return res;
}
template <typename T>
inline double cosAngle(T a, T b, T c) {
  double res = a * a + b * b - c * c;
  res = res / (2 * a * b);
  res = acos(res);
  return res;
}
template <typename T>
inline T power(T base, int po) {
  T res = 1;
  if (base == 0) return 0;
  for (int i = (0); i < (po); i++) res *= base;
  return res;
}
template <typename T>
inline bool isOn(T mask, T pos) {
  return mask & (1 << pos);
}
template <typename T>
inline int Off(T mask, T pos) {
  return mask ^ (1 << pos);
}
template <typename T>
inline int On(T mask, T pos) {
  return mask | (1 << pos);
}
vector<int> v;
int n;
int m;
vector<int> tmp;
int mlen;
int KS;
int a, b, c, d;
int low[15];
int high[15];
set<long long> ST;
int tot;
int total;
vector<int> ans[100000];
void three() {
  int i;
  for (i = 1; i <= 3; i++) {
    if (i == 1) {
      low[tot] = 1;
      high[tot] = 2;
    } else {
      low[tot] = 0;
      high[tot] = 9;
    }
    tot++;
  }
}
void two() {
  int i;
  for (i = 1; i <= 2; i++) {
    if (i == 1) {
      low[tot] = 1;
      high[tot] = 9;
    } else {
      low[tot] = 0;
      high[tot] = 9;
    }
    tot++;
  }
}
void one() {
  low[tot] = 0;
  high[tot] = 9;
  tot++;
}
void pp(int x) {
  if (x == 3) three();
  if (x == 2) two();
  if (x == 1) one();
}
int change[15];
int vis[15];
int arr[15];
void solve(int x, int y, int bit, int last) {
  int i, j;
  if (x > y) {
    if ((bit == ((1 << n) - 1))) {
      long long x = 0;
      ans[total].clear();
      long long res = 0;
      for (i = 0; i < a; i++) {
        res = res * 10 + arr[i];
      }
      x = x * 1000 + res;
      ans[total].push_back(res);
      if (res > 255) return;
      res = 0;
      for (j = a; j < a + b; j++) {
        res = res * 10 + arr[j];
      }
      if (res > 255) return;
      ans[total].push_back(res);
      x = x * 1000 + res;
      res = 0;
      for (j = a + b; j < a + b + c; j++) {
        res = res * 10 + arr[j];
      }
      if (res > 255) return;
      ans[total].push_back(res);
      x = x * 1000 + res;
      res = 0;
      for (j = a + b + c; j < mlen; j++) {
        res = res * 10 + arr[j];
      }
      if (res > 255) return;
      ans[total].push_back(res);
      x = x * 1000 + res;
      if (ST.find(x) != ST.end()) return;
      ST.insert(x);
      total++;
      return;
    } else
      return;
  }
  for (i = 0; i < n; i++) {
    if (low[x] <= tmp[i] && high[x] >= tmp[i] && low[y] <= tmp[i] &&
        high[y] >= tmp[i]) {
      int res = 0;
      arr[x] = tmp[i];
      arr[y] = tmp[i];
      if (x - last == 2 && change[x] != change[x + 1]) {
        for (j = last; j <= x; j++) {
          res = res * 10 + arr[j];
        }
      }
      int nl = last;
      if (change[x] != change[x + 1]) nl = x + 1;
      if (res <= 255) {
        solve(x + 1, y - 1, bit | (1 << i), nl);
      }
    }
  }
  return;
}
int main() {
  int i, j, k;
  cin >> n;
  int x, y;
  for (i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  total = 0;
  sort((v).begin(), (v).end());
  tmp = v;
  int lm = (1 << n);
  for (i = 4; i <= 12; i++) {
    m = 0;
    for (int ii = (1); ii < (4); ii++) {
      for (int jj = (1); jj < (4); jj++) {
        for (int kk = (1); kk < (4); kk++) {
          for (int l = (1); l < (4); l++) {
            mlen = ii + jj + kk + l;
            tot = 0;
            a = ii;
            b = jj;
            c = kk;
            d = l;
            pp(a);
            pp(b);
            pp(c);
            pp(d);
            ++KS;
            for (j = 0; j < a; j++) {
              change[j] = 1;
            }
            for (j = a; j < a + b; j++) {
              change[j] = 2;
            }
            for (j = a + b; j < a + b + c; j++) {
              change[j] = 3;
            }
            for (j = a + b + c; j < mlen; j++) {
              change[j] = 4;
            }
            for (int ii = 0, j = mlen - 1; ii < j; ii++, j--) {
              low[ii] = (low[ii] > low[j] ? low[ii] : low[j]);
              high[ii] = (high[ii] > high[j] ? high[j] : high[ii]);
            }
            solve(0, mlen - 1, 0, 0);
          }
        }
      }
    }
  }
  cout << total << endl;
  for (int i = (0); i < (total); i++) {
    for (int j = (0); j < (4); j++) {
      if (j) printf(".");
      printf("%d", ans[i][j]);
    }
    puts("");
  }
  return 0;
}
