using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Numerics;
using System.Text;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;
        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Get();
            p.Out(x);
        }
        void Add(List<int> result, int i, int m)
        {
            if (i <= m)
                result.Add(i);
        }
        object Get()
        {
            checked
            {
                var n = ReadInt();
                var a = ReadLongs();
                var inserted = new List<Tuple<int, long>>();
                for (int i = 0; i < n - 1; i++)
                    if (NOD(a[i], a[i + 1]) > 1)
                    {
                        inserted.Add(Tuple.Create(i, 1L));
                    }

                var result = new List<long>() { a[0] };
                int j = 0;
                for (int i = 0; i < n - 1; i++)
                {
                    if (j < inserted.Count && i == inserted[j].Item1)
                    {
                        result.Add(inserted[j].Item2);
                        j++;
                    }
                    result.Add(a[i + 1]);
                }
                return inserted.Count + "\n" + result.Select(x => x.ToString()).JoinStrings(" ");
            }
        }

        public long NOD(long a, long b)
        {
            if (a < b)
                return NOD(b, a);
            if (b == 0)
                return a;
            return NOD(b, a % b);
        }

        public double ProcessPair(long[] a, long[] b, int p)
        {
            return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +
                ((double)NumberOfDivs(b, p) * 2000) / Count(b) -
                ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));
        }

        public long NumberOfDivs(long[] a, int p)
        {
            return a[1] / p - (a[0] - 1) / p;
        }

        public long Count(long[] a)
        {
            return a[1] - a[0] + 1;
        }

        bool DoubleEquals(double a, double b)
        {
            return Math.Abs(a - b) < 0.0000000001;
        }

        bool SameLine(double[] a, double[] b, double[] c)
        {
            var x = a[0];
            var y = a[1];
            var x1 = b[0];
            var y1 = b[1];
            var x2 = c[0];
            var y2 = c[1];
            return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));
        }

        object Get7()
        {
            checked
            {
                var m = ReadInt();
                var p = ReadLongs();
                var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();
                var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();
                if (even != null)
                {
                    var index = Array.IndexOf(arr, even);
                    //arr[index].Count = arr[index].Count / 2;
                }
                long divs = 1;
                long result = 1;
                foreach (var a in arr)
                {
                    var pi = a.Key;
                    var curr = pi;
                    var olddivs = divs;
                    var oldres = result;
                    for (int i = 0; i < a.Count; i++)
                    {
                        result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;
                        curr = curr * pi % commonMod;
                        divs = (divs + olddivs) % (commonMod - 1);
                    }
                }
                return result;
            }
        }

        public long FastPow(long x, BigInteger pow, long mod)
        {
            if (pow == 0)
                return 1;
            if ((pow & 1) == 0)
                return FastPow(x * x % mod, pow / 2, mod);
            return x * FastPow(x, pow - 1, mod) % mod;
        }

        class Cut
        {
            public int a;
            public int b;
            public int line;
        }

        //object Get3()
        //{
        //    FileName = "";
        //    checked
        //    {
        //        var n = ReadInt();
        //        var hor = new List<Cut>();
        //        var ver = new List<Cut>();
        //        for (int i = 0; i < n; i++)
        //        {
        //            var a = ReadInts();
        //            if (a[0] == a[2])
        //                ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });
        //            else
        //                hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });
        //        }
        //        ver = Merge(ver);
        //        hor = Merge(hor);

        //    }
        //}

        List<Cut> Merge(List<Cut> l)
        {
            var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();
            Cut previous = null;
            var result = new List<Cut>();
            for (int i = 0; i < a.Length; i++)
                if (previous == null)
                    previous = a[i];
                else
                    if (previous.line == a[i].line && previous.b >= a[i].a)
                        previous.b = Math.Max(previous.b, a[i].b);
                    else
                    {
                        result.Add(previous);
                        previous = a[i];
                    }
            if (previous != null)
                result.Add(previous);
            return result;
        }

    }
    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (string.IsNullOrEmpty(FileName))
                return Console.ReadLine();
            if (f == null)
                f = new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName + ".in");
            return f.ReadLine();
        }

        protected int ReadInt()
        {
            return Convert.ToInt32(Read());
        }
        protected int[] ReadInts()
        {
            return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
        }

        protected long ReadLong()
        {
            return Convert.ToInt64(Read());
        }

        protected long[] ReadLongs()
        {
            return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName + ".out", r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {
            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-NB-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func)
        {
            T result = default(T);
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> source, string delimeter)
        {
            return string.Join(delimeter, source.ToArray());
        }
    }
}


using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Numerics;
using System.Text;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;
        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Get();
            p.Out(x);
        }
        object Get()
        {
            checked
            {
                var n = ReadInt();
                var a = ReadLongs();
                var inserted = new List<Tuple<int, long>>();
                for (int i = 0; i < n - 1; i++)
                   if (NOD(a[i], a[i + 1]) > 1)
                       inserted.Add(Tuple.Create(i, a[i] * a[i + 1] / NOD(a[i], a[i + 1]) + 1));

                var result = new List<long>() { a[0] };
                int j = 0;
                for (int i = 0; i < n - 1; i++)
                {
                    if (i == inserted[j].Item1)
                    {
                        result.Add(inserted[j].Item2);
                        j++;
                    }
                    result.Add(a[i + 1]);
                }
                return inserted.Count + "\n" + result.Select(x => x.ToString()).JoinStrings(" ");
            }
        }

        public long NOD(long a, long b)
        {
            if (a < b)
                return NOD(b, a);
            if (b == 0)
                return a;
            return NOD(b, a % b);
        }

        public double ProcessPair(long[] a, long[] b, int p)
        {
            return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +
                ((double)NumberOfDivs(b, p) * 2000) / Count(b) -
                ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));
        }

        public long NumberOfDivs(long[] a, int p)
        {
            return a[1] / p - (a[0] - 1) / p;
        }

        public long Count(long[] a)
        {
            return a[1] - a[0] + 1;
        }

        bool DoubleEquals(double a, double b)
        {
            return Math.Abs(a - b) < 0.0000000001;
        }

        bool SameLine(double[] a, double[] b, double[] c)
        {
            var x = a[0];
            var y = a[1];
            var x1 = b[0];
            var y1 = b[1];
            var x2 = c[0];
            var y2 = c[1];
            return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));
        }

        object Get7()
        {
            checked
            {
                var m = ReadInt();
                var p = ReadLongs();
                var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();
                var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();
                if (even != null)
                {
                    var index = Array.IndexOf(arr, even);
                    //arr[index].Count = arr[index].Count / 2;
                }
                long divs = 1;
                long result = 1;
                foreach (var a in arr)
                {
                    var pi = a.Key;
                    var curr = pi;
                    var olddivs = divs;
                    var oldres = result;
                    for (int i = 0; i < a.Count; i++)
                    {
                        result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;
                        curr = curr * pi % commonMod;
                        divs = (divs + olddivs) % (commonMod - 1);
                    }
                }
                return result;
            }
        }

        public long FastPow(long x, BigInteger pow, long mod)
        {
            if (pow == 0)
                return 1;
            if ((pow & 1) == 0)
                return FastPow(x * x % mod, pow / 2, mod);
            return x * FastPow(x, pow - 1, mod) % mod;
        }

        class Cut
        {
            public int a;
            public int b;
            public int line;
        }

        //object Get3()
        //{
        //    FileName = "";
        //    checked
        //    {
        //        var n = ReadInt();
        //        var hor = new List<Cut>();
        //        var ver = new List<Cut>();
        //        for (int i = 0; i < n; i++)
        //        {
        //            var a = ReadInts();
        //            if (a[0] == a[2])
        //                ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });
        //            else
        //                hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });
        //        }
        //        ver = Merge(ver);
        //        hor = Merge(hor);

        //    }
        //}

        List<Cut> Merge(List<Cut> l)
        {
            var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();
            Cut previous = null;
            var result = new List<Cut>();
            for (int i = 0; i < a.Length; i++)
                if (previous == null)
                    previous = a[i];
                else
                    if (previous.line == a[i].line && previous.b >= a[i].a)
                        previous.b = Math.Max(previous.b, a[i].b);
                    else
                    {
                        result.Add(previous);
                        previous = a[i];
                    }
            if (previous != null)
                result.Add(previous);
            return result;
        }

    }
    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (string.IsNullOrEmpty(FileName))
                return Console.ReadLine();
            if (f == null)
                f = new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName + ".in");
            return f.ReadLine();
        }

        protected int ReadInt()
        {
            return Convert.ToInt32(Read());
        }
        protected int[] ReadInts()
        {
            return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
        }

        protected long ReadLong()
        {
            return Convert.ToInt64(Read());
        }

        protected long[] ReadLongs()
        {
            return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName + ".out", r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {
            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-NB-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func)
        {
            T result = default(T);
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> source, string delimeter)
        {
            return string.Join(delimeter, source.ToArray());
        }
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace _11a
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static int nod(int a, int b)
        {
            var rem = a % b;
            if (rem == 0)
            {
                return b;
            }

            return nod(b, rem);
        }

        static void solution()
        {
            #region SOLUTION
            var n = readInt();
            var a = readIntArray();
            var res = new List<long>();
            res.Add(a[0]);
            var k = 0;
            for (int i = 1; i < n; i++)
            {
                var no = nod(a[i], a[i - 1]);
                if (no == 1)
                {
                    res.Add(a[i]);
                    continue;
                }

                k++;
                res.Add(1);
                res.Add(a[i]);
            }

            Console.WriteLine(k);
            for (int i = 0; i < res.Count; i++)
            {
                Console.Write("{0} ", res[i]);
            }
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {
        static StreamReader reader;
        static StreamWriter writer;
        static bool inc;
        static int last_x, last_y;

        static void Main(string[] args)
        {
            //#if DEBUG
            reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#else
            //            StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            //            StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#endif
            InputReader input = new InputReader(reader);

            int n = input.NextInt();
            int[] a = input.NextIntArray(n);
            List<int> list = new List<int>();
            list.Add(a[0]);
            for (int i = 1; i < a.Length; i++)
            {
                if (GCD(Math.Max(a[i], a[i - 1]) ,Math.Min(a[i], a[i - 1])) != 1 && !(a[i] == 1 || a[i - 1] == 1))
                {
                    list.Add(1);
                }
                list.Add(a[i]);
            }
            writer.WriteLine(list.Count - a.Length);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    writer.Write(list[i] + (i < list.Count - 1 ? " " : "\n"));
                }
            }
#if DEBUG
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.Black;
#endif
            writer.Close();
            reader.Close();
        }

        private static int GCD(int p1, int p2)
        {
            if (p2 > p1)
            {
                return GCD(p2, p1);
            }
            if (p1 % p2 == 0)
            {
                return p2;
            }
            return GCD(p2, p1 % p2);
        }
    }

    // this class is copy
    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

        private bool IsSpaceChar(int c)
        {
            return !(c >= 33 && c <= 126);
        }

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            return int.Parse(this.Next());
        }

        public int[] NextIntArray(int n)
        {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = NextInt();
            }
            return a;
        }

        public long NextLong()
        {
            return long.Parse(this.Next());
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }

        internal long[] NextLongArray(long n)
        {
            long[] a = new long[(int)n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextLong();
            }
            return a;
        }

        internal double[] NextDoubleArray(int n)
        {
            double[] a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextDouble();
            }
            return a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {
        static StreamReader reader;
        static StreamWriter writer;
        static bool inc;
        static int last_x, last_y;

        static void Main(string[] args)
        {
            //#if DEBUG
            reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#else
            //            StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            //            StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#endif
            InputReader input = new InputReader(reader);

            int n = input.NextInt();
            int[] a = input.NextIntArray(n);
            List<int> list = new List<int>();
            list.Add(a[0]);
            for (int i = 1; i < a.Length; i++)
            {
                if (GCD(Math.Max(a[i], a[i - 1]) ,Math.Min(a[i], a[i - 1])) == 1 && !(a[i] == 1 || a[i - 1] == 1))
                {
                    list.Add(1);
                }
                list.Add(a[i]);
            }
            writer.WriteLine(list.Count - a.Length);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    writer.Write(list[i] + (i < list.Count - 1 ? " " : "\n"));
                }
            }
#if DEBUG
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.Black;
#endif
            writer.Close();
            reader.Close();
        }

        private static int GCD(int p1, int p2)
        {
            if (p2 > p1)
            {
                return GCD(p2, p1);
            }
            if (p1 % p2 == 0)
            {
                return p2;
            }
            return GCD(p2, p1 % p2);
        }
    }

    // this class is copy
    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

        private bool IsSpaceChar(int c)
        {
            return !(c >= 33 && c <= 126);
        }

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            return int.Parse(this.Next());
        }

        public int[] NextIntArray(int n)
        {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = NextInt();
            }
            return a;
        }

        public long NextLong()
        {
            return long.Parse(this.Next());
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }

        internal long[] NextLongArray(long n)
        {
            long[] a = new long[(int)n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextLong();
            }
            return a;
        }

        internal double[] NextDoubleArray(int n)
        {
            double[] a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextDouble();
            }
            return a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {
        static StreamReader reader;
        static StreamWriter writer;
        static bool inc;
        static int last_x, last_y;

        static void Main(string[] args)
        {
            //#if DEBUG
            reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#else
            //            StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            //            StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#endif
            InputReader input = new InputReader(reader);

            int n = input.NextInt();
            int[] a = input.NextIntArray(n);
            List<int> list = new List<int>();
            list.Add(a[0]);
            for (int i = 1; i < a.Length; i++)
            {
                if (Math.Max(a[i], a[i - 1]) % Math.Min(a[i], a[i - 1]) == 0)
                {
                    list.Add(1);
                }
                list.Add(a[i]);
            }
            writer.WriteLine(list.Count - a.Length);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    writer.Write(list[i] + (i < list.Count - 1 ? " " : "\n"));
                }
            }
#if DEBUG
                Console.BackgroundColor = ConsoleColor.White;
                Console.ForegroundColor = ConsoleColor.Black;
#endif
            writer.Close();
            reader.Close();
        }
    }

    // this class is copy
    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

        private bool IsSpaceChar(int c)
        {
            return !(c >= 33 && c <= 126);
        }

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            return int.Parse(this.Next());
        }

        public int[] NextIntArray(int n)
        {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = NextInt();
            }
            return a;
        }

        public long NextLong()
        {
            return long.Parse(this.Next());
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }

        internal long[] NextLongArray(long n)
        {
            long[] a = new long[(int)n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextLong();
            }
            return a;
        }

        internal double[] NextDoubleArray(int n)
        {
            double[] a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextDouble();
            }
            return a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {
        static StreamReader reader;
        static StreamWriter writer;
        static bool inc;
        static int last_x, last_y;

        static void Main(string[] args)
        {
            //#if DEBUG
            reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#else
            //            StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            //            StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#endif
            InputReader input = new InputReader(reader);

            int n = input.NextInt();
            int[] a = input.NextIntArray(n);
            List<int> list = new List<int>();
            list.Add(a[0]);
            for (int i = 1; i < a.Length; i++)
            {
                if (Math.Max(a[i], a[i - 1]) % Math.Min(a[i], a[i - 1]) == 0 && !(a[i]==1 || a[i-1]==1))
                {
                    list.Add(1);
                }
                list.Add(a[i]);
            }
            writer.WriteLine(list.Count - a.Length);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    writer.Write(list[i] + (i < list.Count - 1 ? " " : "\n"));
                }
            }
#if DEBUG
                Console.BackgroundColor = ConsoleColor.White;
                Console.ForegroundColor = ConsoleColor.Black;
#endif
            writer.Close();
            reader.Close();
        }
    }

    // this class is copy
    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

        private bool IsSpaceChar(int c)
        {
            return !(c >= 33 && c <= 126);
        }

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            return int.Parse(this.Next());
        }

        public int[] NextIntArray(int n)
        {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = NextInt();
            }
            return a;
        }

        public long NextLong()
        {
            return long.Parse(this.Next());
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }

        internal long[] NextLongArray(long n)
        {
            long[] a = new long[(int)n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextLong();
            }
            return a;
        }

        internal double[] NextDoubleArray(int n)
        {
            double[] a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextDouble();
            }
            return a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {
        static StreamReader reader;
        static StreamWriter writer;
        static bool inc;
        static int last_x, last_y;

        static void Main(string[] args)
        {
            //#if DEBUG
            reader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#else
            //            StreamReader streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            //            StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
            //#endif
            InputReader input = new InputReader(reader);

            int n = input.NextInt();
            int[] a = input.NextIntArray(n);
            List<int> list = new List<int>();
            list.Add(a[0]);
            for (int i = 1; i < a.Length; i++)
            {
                if (Math.Max(a[i], a[i - 1]) % Math.Min(a[i], a[i - 1]) == 0 && !(a[i]==1 && a[i-1]==1))
                {
                    list.Add(1);
                }
                list.Add(a[i]);
            }
            writer.WriteLine(list.Count - a.Length);
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    writer.Write(list[i] + (i < list.Count - 1 ? " " : "\n"));
                }
            }
#if DEBUG
                Console.BackgroundColor = ConsoleColor.White;
                Console.ForegroundColor = ConsoleColor.Black;
#endif
            writer.Close();
            reader.Close();
        }
    }

    // this class is copy
    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

        private bool IsSpaceChar(int c)
        {
            return !(c >= 33 && c <= 126);
        }

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            return int.Parse(this.Next());
        }

        public int[] NextIntArray(int n)
        {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = NextInt();
            }
            return a;
        }

        public long NextLong()
        {
            return long.Parse(this.Next());
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }

        internal long[] NextLongArray(long n)
        {
            long[] a = new long[(int)n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextLong();
            }
            return a;
        }

        internal double[] NextDoubleArray(int n)
        {
            double[] a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = NextDouble();
            }
            return a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            {
                task.Solve(1, sr, sw);
            }
            //Console.ReadKey();
        }
    }

    internal class Task
    {
        private bool inBorder = false;

        public void Solve(int testNumber, InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var primes = Primes(100000);
            var curr = 0;
            var result = new List<int>();
            result.Add(array[0]);
            for (var i = 1; i < array.Length; i++)
            {
                var first = array[i - 1];
                var second = array[i];
                if (Gcd(first, second) != 1)
                {
                    while (Gcd(second, primes[curr]) != 1)
                    {
                        curr++;
                    }
                    result.Add(primes[curr]);
                    result.Add(second);
                    curr++;
                }
                else
                {
                    result.Add(second);
                }
            }

            sw.WriteLine(result.Count - n);
            foreach (var i in result)
            {
                sw.Write(i + " ");
            }
        }

        private int Gcd(int a, int b)
        {
            if (b == 0)
                return a;
            return Gcd(b, a%b);
        }

        private List<int> Primes(int max)
        {
            var primes = Enumerable.Repeat(true, max).ToArray();
            primes[0] = false;
            primes[1] = false;
            for (var i = 2; i < max; i++)
            {
                if (!primes[i])
                {
                    for (var j = 2*i; j < max; j += i)
                    {
                        primes[j] = false;
                    }
                }
            }
            var result = new List<int>();
            for (var i = 2; i < max; i++)
            {
                if (primes[i])
                {
                    result.Add(i);
                }
            }

            return result;
        }
    }

    internal class InputReader : IDisposable
    {
        private bool isDispose;
        private readonly TextReader sr;

        public InputReader(TextReader stream)
        {
            sr = stream;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        public string NextString()
        {
            var result = sr.ReadLine();
            return result;
        }

        public int NextInt32()
        {
            return Int32.Parse(NextString());
        }

        public long NextInt64()
        {
            return Int64.Parse(NextString());
        }

        public string[] NextSplitStrings()
        {
            return NextString()
                .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
        }

        public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
        {
            return NextSplitStrings()
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
        }

        public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
        {
            return
                str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)
                    .Select(s => func(s, CultureInfo.InvariantCulture))
                    .ToArray();
        }

        protected void Dispose(bool dispose)
        {
            if (!isDispose)
            {
                if (dispose)
                    sr.Close();
                isDispose = true;
            }
        }

        ~InputReader()
        {
            Dispose(false);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            {
                task.Solve(1, sr, sw);
            }
            //Console.ReadKey();
        }
    }

    internal class Task
    {
        private bool inBorder = false;

        public void Solve(int testNumber, InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var primes = Primes(100000);
            var curr = 0;
            var result = new List<int>();
            result.Add(array[0]);
            for (var i = 1; i < array.Length; i++)
            {
                var first = array[i - 1];
                var second = array[i];
                if (Gcd(first, second) != 1)
                {
                    while (Gcd(second, primes[curr]) != 1 || Gcd(first, primes[curr]) != 1)
                    {
                        curr++;
                    }
                    result.Add(primes[curr]);
                    result.Add(second);
                    curr++;
                }
                else
                {
                    result.Add(second);
                }
            }

            sw.WriteLine(result.Count - n);
            foreach (var i in result)
            {
                sw.Write(i + " ");
            }
        }

        private int Gcd(int a, int b)
        {
            if (b == 0)
                return a;
            return Gcd(b, a%b);
        }

        private List<int> Primes(int max)
        {
            var primes = Enumerable.Repeat(true, max).ToArray();
            primes[0] = false;
            primes[1] = false;
            for (var i = 2; i < max; i++)
            {
                if (!primes[i])
                {
                    for (var j = 2*i; j < max; j += i)
                    {
                        primes[j] = false;
                    }
                }
            }
            var result = new List<int>();
            for (var i = 2; i < max; i++)
            {
                if (primes[i])
                {
                    result.Add(i);
                }
            }

            return result;
        }
    }

    internal class InputReader : IDisposable
    {
        private bool isDispose;
        private readonly TextReader sr;

        public InputReader(TextReader stream)
        {
            sr = stream;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        public string NextString()
        {
            var result = sr.ReadLine();
            return result;
        }

        public int NextInt32()
        {
            return Int32.Parse(NextString());
        }

        public long NextInt64()
        {
            return Int64.Parse(NextString());
        }

        public string[] NextSplitStrings()
        {
            return NextString()
                .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
        }

        public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
        {
            return NextSplitStrings()
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
        }

        public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
        {
            return
                str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)
                    .Select(s => func(s, CultureInfo.InvariantCulture))
                    .ToArray();
        }

        protected void Dispose(bool dispose)
        {
            if (!isDispose)
            {
                if (dispose)
                    sr.Close();
                isDispose = true;
            }
        }

        ~InputReader()
        {
            Dispose(false);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            {
                task.Solve(1, sr, sw);
            }
            //Console.ReadKey();
        }
    }

    internal class Task
    {
        private bool inBorder = false;

        public void Solve(int testNumber, InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            var primes = Primes(100000);
            var curr = 0;
            var result = new List<int>();
            result.Add(array[0]);
            for (var i = 1; i < array.Length; i++)
            {
                var first = array[i - 1];
                var second = array[i];
                if (Gcd(first, second) != 1)
                {
                    while (Gcd(second, primes[curr]) != 1 && Gcd(first, primes[curr]) != 1)
                    {
                        curr++;
                    }
                    result.Add(primes[curr]);
                    result.Add(second);
                    curr++;
                }
                else
                {
                    result.Add(second);
                }
            }

            sw.WriteLine(result.Count - n);
            foreach (var i in result)
            {
                sw.Write(i + " ");
            }
        }

        private int Gcd(int a, int b)
        {
            if (b == 0)
                return a;
            return Gcd(b, a%b);
        }

        private List<int> Primes(int max)
        {
            var primes = Enumerable.Repeat(true, max).ToArray();
            primes[0] = false;
            primes[1] = false;
            for (var i = 2; i < max; i++)
            {
                if (!primes[i])
                {
                    for (var j = 2*i; j < max; j += i)
                    {
                        primes[j] = false;
                    }
                }
            }
            var result = new List<int>();
            for (var i = 2; i < max; i++)
            {
                if (primes[i])
                {
                    result.Add(i);
                }
            }

            return result;
        }
    }

    internal class InputReader : IDisposable
    {
        private bool isDispose;
        private readonly TextReader sr;

        public InputReader(TextReader stream)
        {
            sr = stream;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        public string NextString()
        {
            var result = sr.ReadLine();
            return result;
        }

        public int NextInt32()
        {
            return Int32.Parse(NextString());
        }

        public long NextInt64()
        {
            return Int64.Parse(NextString());
        }

        public string[] NextSplitStrings()
        {
            return NextString()
                .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
        }

        public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
        {
            return NextSplitStrings()
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
        }

        public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
        {
            return
                str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)
                    .Select(s => func(s, CultureInfo.InvariantCulture))
                    .ToArray();
        }

        protected void Dispose(bool dispose)
        {
            if (!isDispose)
            {
                if (dispose)
                    sr.Close();
                isDispose = true;
            }
        }

        ~InputReader()
        {
            Dispose(false);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var sr = new InputReader(Console.In);
            //var sr = new InputReader(new StreamReader("input.txt"));
            var task = new Task();
            using (var sw = Console.Out)
            {
                task.Solve(1, sr, sw);
            }
            //Console.ReadKey();
        }
    }

    internal class Task
    {
        private bool inBorder = false;

        public void Solve(int testNumber, InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var array = sr.ReadArray(Int32.Parse);
            for (var i = 1; i < array.Length; i++)
            {
                var first = array[i - 1];
                var second = array[i];
                if (Gcd(first, second) != 1)
                {
                    var found = false;
                    for (var j = second + 1; j <= 1000000000; j++)
                    {
                        if (Gcd(first, j) == 1)
                        {
                            array[i] = j;
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        for (var j = second - 1; j >= 1; j--)
                        {
                            if (Gcd(first, j) == 1)
                            {
                                array[i] = j;
                                break;
                            }
                        }
                    }
                }
            }

            foreach (var i in array)
            {
                sw.Write(i + " ");
            }
        }

        private int Gcd(int a, int b)
        {
            if (b == 0)
            {
                return a;
            }
            return Gcd(b, a%b);
        }
    }

    internal class InputReader : IDisposable
    {
        private bool isDispose;
        private readonly TextReader sr;

        public InputReader(TextReader stream)
        {
            sr = stream;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        public string NextString()
        {
            var result = sr.ReadLine();
            return result;
        }

        public int NextInt32()
        {
            return Int32.Parse(NextString());
        }

        public long NextInt64()
        {
            return Int64.Parse(NextString());
        }

        public string[] NextSplitStrings()
        {
            return NextString()
                .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
        }

        public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
        {
            return NextSplitStrings()
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
        }

        public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
        {
            return
                str.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)
                    .Select(s => func(s, CultureInfo.InvariantCulture))
                    .ToArray();
        }

        protected void Dispose(bool dispose)
        {
            if (!isDispose)
            {
                if (dispose)
                    sr.Close();
                isDispose = true;
            }
        }

        ~InputReader()
        {
            Dispose(false);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Numerics;
using System.Text;

namespace Olimp
{
    public class Text : IDisposable
    {
        private readonly StreamReader _reader;
        public Text()
        {
            _reader = new StreamReader(Console.OpenStandardInput());
        }

        ~Text()
        {
            _reader.Dispose();
        }

        public void Dispose()
        {
            _reader.Dispose();
        }

        public string GetWord()
        {
            int i;
            do
            {
                i = _reader.Read();
            } while (char.IsWhiteSpace((char)i));

            var c = (char)(i);
            var sb = new StringBuilder();

            do
            {
                sb.Append(c);
                i = _reader.Peek();
                if (i == -1)
                    break;
                c = (char)(i);
                if (char.IsWhiteSpace(c))
                    break;
                _reader.Read();
            } while (true);

            return sb.ToString();
        }

        public long GetInt64()
        {
            long x;
            try
            {
                x = Convert.ToInt64(GetWord());
            }
            catch (Exception)
            {
                x = 0;
            }
            return x;
        }

        public ulong GetUInt64()
        {
            ulong x;
            try
            {
                x = Convert.ToUInt64(GetWord());
            }
            catch (Exception)
            {
                x = 0;
            }
            return x;
        }

        public int GetInt()
        {
            return (int)GetInt64();
        }

        public uint GetUInt()
        {
            return (uint)GetUInt64();
        }

        public uint GetDWord()
        {
            return (uint)GetUInt64();
        }

        public double GetDouble()
        {
            double x;
            try
            {
                x = Convert.ToDouble(GetWord(), new CultureInfo("en-US"));
            }
            catch (Exception)
            {
                x = 0.0;
            }
            return x;
        }

        public string GetString()
        {
            return _reader.ReadLine();
        }

        public void Close()
        {
            _reader.Close();
        }
    }

    class Program
    {
        public static int Gcd(int x, int y)
        {
            while(true)
            {
                if (x == 0) return y;
                if (y == 0) return x;
                if (x > y) x %= y; else y %= x;
            }
        }

        static void Main(string[] args)
        {
            var t = new Text();
            int n = t.GetInt();

            var a = new List<int>();
            var b = new List<int>();

            for (int i = 0; i < n; i++) a.Add(t.GetInt());

            b.Add(a[0]);
            for (int i = 1; i < n; i++)
            {
                if(Gcd(a[i], b[b.Count - 1]) != 1)
                    b.Add(1);
                b.Add(a[i]);
            }

            Console.WriteLine(b.Count - a.Count);
            foreach (var x in b) Console.Write("{0} ", x);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace ReadWriteTemplate
{
    public static class Solver
    {
        public static void Solve()
        {
            var n = ReadInt();
            var a = ReadIntArray();

            List<int> b = new List<int>();

            b.Add(a[0]);
            for (int i = 1; i < n; i++)
            {
                if (Gcd(a[i - 1], a[i]) > 1)
                {
                    b.Add(1);
                }
                b.Add(a[i]);
            }

            Writer.WriteLine(b.Count);
            Writer.WriteLine(string.Join(" ", b));
        }

        public static int Gcd(int a, int b)
        {
            while (b != 0)
            {
                var tmp = a;
                a = b;
                b = tmp % b;
            }
            return a;
        }

        public static void Main()
        {
            Reader = Console.In; Writer = Console.Out;
            //Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");

            Solve();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }

    public class AccDict<T>
    {
        private Dictionary<T, long> _dict = new Dictionary<T, long>();

        public void Add(T key)
        {
            if (_dict.ContainsKey(key))
            {
                _dict[key]++;
            }
            else
            {
                _dict[key] = 1;
            }
        }

        public long Get(T key)
        {
            return _dict.ContainsKey(key) ? _dict[key] : 0;
        }

        public Dictionary<T, long>.ValueCollection Values
        {
            get { return _dict.Values; }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace ReadWriteTemplate
{
    public static class Solver
    {
        public static void Solve()
        {
            var n = ReadInt();
            var a = ReadIntArray();

            List<int> b = new List<int>();

            b.Add(a[0]);
            for (int i = 1; i < n; i++)
            {
                if (Gcd(a[i - 1], a[i]) > 1)
                {
                    b.Add(1);
                }
                b.Add(a[i]);
            }

            Writer.WriteLine(b.Count);
            Writer.WriteLine(string.Join(" ", b));
        }

        public static int Gcd(int a, int b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static void Main()
        {
            //Reader = Console.In; Writer = Console.Out;
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");

            Solve();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }

    public class AccDict<T>
    {
        private Dictionary<T, long> _dict = new Dictionary<T, long>();

        public void Add(T key)
        {
            if (_dict.ContainsKey(key))
            {
                _dict[key]++;
            }
            else
            {
                _dict[key] = 1;
            }
        }

        public long Get(T key)
        {
            return _dict.ContainsKey(key) ? _dict[key] : 0;
        }

        public Dictionary<T, long>.ValueCollection Values
        {
            get { return _dict.Values; }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace ReadWriteTemplate
{
    public static class Solver
    {
        public static void Solve()
        {
            var n = ReadInt();
            var a = ReadIntArray();

            List<int> b = new List<int>();

            b.Add(a[0]);
            for (int i = 1; i < n; i++)
            {
                if (Gcd(a[i - 1], a[i]) > 1)
                {
                    b.Add(1);
                }
                b.Add(a[i]);
            }

            Writer.WriteLine(b.Count - n);
            Writer.WriteLine(string.Join(" ", b));
        }

        public static int Gcd(int a, int b)
        {
            while (b != 0)
            {
                var tmp = a;
                a = b;
                b = tmp % b;
            }
            return a;
        }

        public static void Main()
        {
            Reader = Console.In; Writer = Console.Out;
            //Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");

            Solve();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }

    public class AccDict<T>
    {
        private Dictionary<T, long> _dict = new Dictionary<T, long>();

        public void Add(T key)
        {
            if (_dict.ContainsKey(key))
            {
                _dict[key]++;
            }
            else
            {
                _dict[key] = 1;
            }
        }

        public long Get(T key)
        {
            return _dict.ContainsKey(key) ? _dict[key] : 0;
        }

        public Dictionary<T, long>.ValueCollection Values
        {
            get { return _dict.Values; }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace Co_Prime
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] array = Array.ConvertAll( Console.ReadLine().Split(null), int.Parse );
            List<int> output = new List<int>();
            int k = 0;
            if (n == 1)
            {
                Console.WriteLine(0);
                Console.WriteLine(array[0]);
                return;
            }

            for (int i = 0; i < n-1; i++)
            {
                if ( GCD(array[i], array[i+1]) == 1 )
                {
                    output.Add(array[i]);
                }
                else
                {
                    k++;
                    output.Add(array[i]);
                    output.Add(1);
                }
            }
            output.Add(array[n-1]);

            Console.WriteLine(k);
            foreach (var item in output)
            {
                Console.Write(item+" ");
            }
        }
        public static int GCD(int a, int b)
        {
            if (b == 0) return a;
            return GCD(b, a % b);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Net;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }

    public void Solve()
    {
        int n = ReadInt();
        var a = ReadIntArray();

        var ans = new List<int>();
        for (int i = 0; i < n; i++)
        {
            if (i > 0 && Gcd(a[i], a[i - 1]) > 1)
                ans.Add(1);
            ans.Add(a[i]);
        }

        Write(ans.Count - n);
        WriteArray(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace codeforces3621a
{
	class Program
	{
		static long[] left = new long[500005];
		static long[] right = new long[500005];

		static string s;
		static long b;
		static long n;

		static void Main(string[] args)
		{
#if DEBUG
			TextReader reader = new StreamReader("..\\..\\input.txt");
#else
			TextReader reader = new StreamReader(Console.OpenStandardInput());
#endif
			TextWriter writer = new StreamWriter(Console.OpenStandardOutput());

			var result = new List<string>();
			var n = int.Parse(reader.ReadLine());
			var d = reader.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();

			var i = 0;
			var r = 0;
			while (i < d.Count-1)
			{
				if (gcd(d[i], d[i + 1]) > 1)
				{
					d.Insert(i + 1, d[i] * d[i+1] + 1);
					r++;
					i++;
				}
				i++;
			}

			writer.WriteLine(r);
			writer.Write(d[0]);
			d.Skip(1).ToList().ForEach(x => writer.Write(" " + x));
			writer.WriteLine();
			reader.Close();
			writer.Close();
		}

		private static long gcd(long a, long b)
		{
			var max = Math.Max(a, b);
			var min = Math.Min(a, b);
			return max % min == 0 ? min : gcd(min, max % min);
		}
	}
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace codeforces3621a
{
	class Program
	{
		static long[] left = new long[500005];
		static long[] right = new long[500005];

		static string s;
		static long b;
		static long n;

		static void Main(string[] args)
		{
#if DEBUG
			TextReader reader = new StreamReader("..\\..\\input.txt");
#else
			TextReader reader = new StreamReader(Console.OpenStandardInput());
#endif
			TextWriter writer = new StreamWriter(Console.OpenStandardOutput());

			var result = new List<string>();
			var n = int.Parse(reader.ReadLine());
			var d = reader.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();

			var i = 0;
			while (i < d.Count-1)
			{
				if (gcd(d[i], d[i + 1]) > 1)
				{
					d.Insert(i + 1, d[i] * d[i+1] + 1);
					i++;
				}
				i++;
			}

			writer.WriteLine(d.Count);
			writer.Write(d[0]);
			d.Skip(1).ToList().ForEach(x => writer.Write(" " + x));
			writer.WriteLine();
			reader.Close();
			writer.Close();
		}

		private static long gcd(long a, long b)
		{
			var max = Math.Max(a, b);
			var min = Math.Min(a, b);
			return max % min == 0 ? min : gcd(min, max % min);
		}
	}
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace codeforces3621a
{
	class Program
	{
		static long[] left = new long[500005];
		static long[] right = new long[500005];

		static string s;
		static long b;
		static long n;

		static void Main(string[] args)
		{
#if DEBUG
			TextReader reader = new StreamReader("..\\..\\input.txt");
#else
			TextReader reader = new StreamReader(Console.OpenStandardInput());
#endif
			TextWriter writer = new StreamWriter(Console.OpenStandardOutput());

			var result = new List<string>();
			var n = int.Parse(reader.ReadLine());
			var d = reader.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();

			var i = 0;
			while (i < d.Count-1)
			{
				if (gcd(d[i], d[i + 1]) > 1)
				{
					d.Insert(i + 1, d[i] * d[i+1] + 1);
					i++;
				}
				i++;
			}

			writer.WriteLine(d.Count);
			writer.Write(d[0]);
			d.Skip(1).ToList().ForEach(x => writer.Write(" " + x));
			//writer.WriteLine();
			reader.Close();
			writer.Close();
		}

		private static long gcd(long a, long b)
		{
			var max = Math.Max(a, b);
			var min = Math.Min(a, b);
			return max % min == 0 ? min : gcd(min, max % min);
		}
	}
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int k = 0;
            string ans = Convert.ToString(c[0])+ " ";
            for (int i = 0; i < n-1; i++)
            {
                if (NOD(c[i + 1], c[i]) != 1)
                {
                    ans += "1 " + c[i+1] + " ";
                    k++;
                }
                else
                    ans += c[i+1] + " ";
            }
            Console.WriteLine(k);
           Console.WriteLine(ans);
        }
        public static int NOD(int m, int n)
        {
            int nod = 0;
            for (int i = 1; i < (n * m + 1); i++)
            {
                if (m % i == 0 && n % i == 0)
                {
                    nod = i;
                }
            }
            return nod;
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] c = Console.ReadLine().Split(' ');
            int k = 0;
            string ans = Convert.ToString(c[0])+ " ";
            for (int i = 0; i < n-1; i++)
            {
                if (gcd(int.Parse(c[i + 1]), int.Parse(c[i])) != 1)
                {
                    ans += "1 " + c[i+1] + " ";
                    k++;
                }
                else
                    ans += c[i+1] + " ";
            }
            Console.WriteLine(k);
            Console.WriteLine(ans);
        }
        public static int gcd(int a, int b)
        {
            while (b != 0)
                b = a % (a = b);
            return a;
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using System.Globalization;
using System.Threading;
using System.Web.Script.Serialization;

class Program
{
    private static int D(char ch)
    {
        if (ch == '(') return 1;
        return -1;
    }

    public class SuffixArray
    {
        public string text;
        public int[] sa;
        public int n;

        // suffix array in O(n*log(n))
        public SuffixArray(string str)
        {
            text = str;
            n = str.Length;
            // sa[i] - suffix on i'th position after sorting by first len characters
            sa = new int[n];

            // rank[i] - position of the i'th suffix after sorting by first len characters
            int[] rank = new int[n];
            int maxlen = n;
            for (int i = 0; i < n; i++)
            {
                rank[i] = str[i];
                maxlen = Math.Max(maxlen, str[i] + 1);
            }

            // counting sort of input characters
            int[] cnt = new int[maxlen];
            for (int i = 0; i < n; i++)
                ++cnt[rank[i]];
            for (int i = 1; i < cnt.Length; i++)
                cnt[i] += cnt[i - 1];
            for (int i = 0; i < n; i++)
                sa[--cnt[rank[i]]] = i;

            for (int len = 1; len < n; len *= 2)
            {
                // Suffixes are already sorted by first len characters.
                // Now sort suffixes by first len * 2 characters.
                int[] r = (int[])rank.Clone();
                rank[sa[0]] = 0;
                for (int i = 1; i < n; i++)
                {
                    int s1 = sa[i - 1];
                    int s2 = sa[i];
                    rank[s2] = r[s1] == r[s2] && Math.Max(s1, s2) + len < n && r[s1 + len / 2] == r[s2 + len / 2] ? rank[s1] : i;
                }
                for (int i = 0; i < n; i++)
                    cnt[i] = i;
                int[] s = (int[])sa.Clone();
                for (int i = 0; i < n; i++)
                {
                    // s[i] - order of suffixes sorted by first len characters
                    // (s[i] - len) - order of suffixes sorted by second len characters
                    int s1 = s[i] - len;
                    if (s1 >= 0)
                        sa[cnt[rank[s1]]++] = s1;
                }
            }
        }

        // longest common prefixes array in O(n)
        public int[] LCP()
        {
            int n = sa.Length;
            int[] rank = new int[n];
            for (int i = 0; i < n; i++)
                rank[sa[i]] = i;
            int[] lcp = new int[n - 1];
            for (int i = 0, h = 0; i < n; i++)
            {
                if (rank[i] < n - 1)
                {
                    for (int j = sa[rank[i] + 1]; Math.Max(i, j) + h < n && text[i + h] == text[j + h]; ++h) ;
                    lcp[rank[i]] = h;
                    if (h > 0)
                        --h;
                }
            }
            return lcp;
        }
    }

    private static int GetMid(int l, int r, int len)
    {
        //if (l == r) return l + 1;
        if (s[sa.sa[l] + len] == ')') return l;
        if (s[sa.sa[r] + len] == '(') return r+1;

        while (r - l > 1)
        {
            int mid = (l + r) / 2;
            if (s[sa.sa[mid] + len] == '(')
                l = mid;
            else
                r = mid;

        }

        return r;
    }

    private static long same = 0;
    private static long notSame = 0;
    public static long Go(int l, int r, int sum, int len)
    {
        if (sum < 0) return 0;
        if (l > r) return 0;
        long answer = 0;
        if (sum == 0) answer++;

        if (l == r) same++;
        if (l != r) notSame++;
        if (sa.sa[l] + len == s.Length) l++;

        if (l == r)
        {
            int pendingLength = s.Length - sa.sa[l] - len;
            for (int i = sa.sa[l] + len; i < s.Length; i++)
            {
                sum += D(s[i]);
                if (sum == 0) answer++;
                if (sum < 0) break;
            }
        }

        if (l < r)
        {
            int mid = GetMid(l, r, len);

            answer += Go(l, mid - 1, sum + 1, len + 1);
            answer += Go(mid, r, sum - 1, len + 1);
        }

        return answer;
    }

    private static SuffixArray sa;
    public static string s;
    private static long SolveAc(string s)
    {
        var dt1 = DateTime.Now;
        sa = new SuffixArray(s);
        var answer = Go(0, s.Length - 1, 0, 0) - 1; ;
        var dt2 = DateTime.Now;

        Console.WriteLine((dt2 - dt1).TotalMilliseconds);

        return answer;
    }

    private static int GetIntValue(int[] m)
    {
        int a = 0;
        for (int i = 0; i < m.Length; i++)
            a += (m[i] << i);
        return a;
    }

    private static int[] ToArray(string s)
    {
        int[] ans = new int[s.Length];
        for (int i = 0; i < s.Length; i++)
            ans[i] = (s[i] == '+' ? 0 : 1);
        return ans;
    }

    private static string ToStr(int x, int l)
    {
        string a = "";
        for (int i = 0; i < l; i++)
            a += ((x & (1 << i)) > 0) ? '-' : '+';
        return a;
    }

    private static void Flip(int[] m, int l)
    {
        for (int i = 0; i < l; i++) m[i] = (1 - m[i]);
        for (int i = 0; i < l / 2; i++) Swap(ref m[i], ref m[l - i - 1]);
    }

    private static int[] dp = new int[1 << 11];
    private static void Populate(int[] m, int l)
    {
        int x = GetIntValue(m);
        if (dp[x] <= l) return;

        dp[x] = l;

        for (int i = 1; i <= m.Length; i++)
        {
            Flip(m, i);
            Populate(m, l + 1);
            Flip(m, i);
        }
    }

    private static int GetAnswer(int x, int n)
    {
        int ans = 0;
        var s = ToStr(x, n);
        for (int i = 1; i < n; i++)
            if (s[i] == '-' && s[i - 1] == '+')
                ans += 2;

        if (s[0] == '-')
            ans++;

        return ans;
    }

    private static int[] SolveBf(int n)
    {
        int[] dp = new int[1 << n];
        for (int i = 0; i < dp.Length; i++)
            dp[i] = GetAnswer(i, n);
        return dp;
    }

    private static int GCD(int a, int b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }
    private static void Main(string[] args)
    {
        int n = ReadInt();
        int[] a = ReadIntArray(n);
        List<int> ans = new List<int>() { a[0] };
        for (int i = 1; i < n; i++)
        {
            if (GCD(a[i], a[i - 1]) > 1)
            {
                ans.Add(1);
            }
            ans.Add(a[i]);
        }
        Console.WriteLine(ans.Count - n);
        Console.WriteLine(string.Join(" ", ans));
    }

    private static Random rnd = new Random();
    private static void TrickyTest()
    {

        var sb = new StringBuilder();
        int iteration = 0;
        while (sb.Length < 250000)
        {
            iteration++;
            int l = 1;
            if (iteration % 1024 == 0) l = (iteration / 1024);

            for (int i = 0; i < l; i++) sb.Append('(');
            for (int i = 0; i < l; i++) sb.Append(')');
        }

        s = sb.ToString() + sb.ToString();
        Console.Write(SolveAc(s));
        Console.WriteLine();
        Console.WriteLine(same);
        Console.WriteLine(notSame);
        Console.WriteLine(292022271 + " AC");
    }

    private static void Test()
    {
        string s = "";
        while (true)
        {
            int n = rnd.Next(1, 300);
            char[] ch = new char[n];
            for (int i = 0; i < n; i++)
                ch[i] = (rnd.Next(2) == 1) ? '(' : ')';

            s = new string(ch);

            var bf = SolveBf(s);
            var ac = SolveAc(s);

            if (ac != bf)
            {
                Console.WriteLine(s);

                Console.WriteLine(ac);
                Console.WriteLine(bf);
            }

        }
    }

    private static long SolveBf(string s)
    {
        HashSet<string> ans = new HashSet<string>();
        for (int l = 1; l <= s.Length; l++)
            for (int i = 0; i < s.Length - l + 1; i++)
            {
                string ss = s.Substring(i, l);
                if (IsCorrect(ss))
                {
                    ans.Add(ss);
                }
            }

        return ans.Count;
    }

    private static bool IsCorrect(string s)
    {
        if (s.Length % 2 != 0) return false;
        int count = 0;
        for (int i = 0; i < s.Length; i++)
        {
            count += D(s[i]);
            if (count < 0) return false;
        }

        return count == 0;
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < n; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt() - 1;
            int b = ReadInt() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int ReadInt()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong ReadULong()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long ReadLong()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] ReadIntArray(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadInt();
        return ans;
    }

    private static long[] ReadLongArray(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadLong();
        return ans;
    }

    private static char[] ReadString()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(string data)
    {
#if !ONLINE_JUDGE
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
}