#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
bool check(int a, int b) {
  if (gcd(a, b) == 1)
    return true;
  else
    return false;
}
int main() {
  int n;
  cin >> n;
  int res = n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    v.push_back(k);
  }
  for (int j = 1; j <= n - 1; j++) {
    if (check(v[j - 1], v[j]))
      ;
    else
      v.insert(v.begin() + j, 1), n++;
  }
  cout << n - res << "\n";
  for (auto itr = v.begin(); itr != v.end(); itr++) cout << *itr << " ";
  cout << "\n";
}
