#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
vector<int> num;
int main() {
  int n;
  int count = 0;
  cin >> n;
  int temp;
  cin >> temp;
  num.push_back(temp);
  for (int i = 1; i < n; i++) {
    cin >> temp;
    int t1 = num.at(num.size() - 1);
    if (gcd(max(t1, temp), min(t1, temp)) == 1) {
      num.push_back(temp);
    } else {
      count++;
      num.push_back(1);
      num.push_back(temp);
    }
  }
  cout << count << endl;
  for (int i = 0; i < num.size(); i++) {
    cout << num[i] << " ";
  }
  cout << endl;
  return 0;
}
