{"raw_statement":[{"iden":"statement","content":"Mike has a sequence _A_ = \\[_a_1, _a_2, ..., _a__n_\\] of length _n_. He considers the sequence _B_ = \\[_b_1, _b_2, ..., _b__n_\\] beautiful if the _gcd_ of all its elements is bigger than 1, i.e. .\n\nMike wants to change his sequence in order to make it beautiful. In one move he can choose an index _i_ (1 ≤ _i_ < _n_), delete numbers _a__i_, _a__i_ + 1 and put numbers _a__i_ - _a__i_ + 1, _a__i_ + _a__i_ + 1 in their place instead, in this order. He wants perform as few operations as possible. Find the minimal number of operations to make sequence _A_ beautiful if it's possible, or tell him that it is impossible to do so.\n\nis the biggest non-negative number _d_ such that _d_ divides _b__i_ for every _i_ (1 ≤ _i_ ≤ _n_)."},{"iden":"input","content":"The first line contains a single integer _n_ (2 ≤ _n_ ≤ 100 000) — length of sequence _A_.\n\nThe second line contains _n_ space-separated integers _a_1, _a_2, ..., _a__n_ (1 ≤ _a__i_ ≤ 109) — elements of sequence _A_."},{"iden":"output","content":"Output on the first line \"_YES_\" (without quotes) if it is possible to make sequence _A_ beautiful by performing operations described above, and \"_NO_\" (without quotes) otherwise.\n\nIf the answer was \"_YES_\", output the minimal number of moves needed to make sequence _A_ beautiful."},{"iden":"examples","content":"Input\n\n2\n1 1\n\nOutput\n\nYES\n1\n\nInput\n\n3\n6 2 4\n\nOutput\n\nYES\n0\n\nInput\n\n2\n1 3\n\nOutput\n\nYES\n1"},{"iden":"note","content":"In the first example you can simply make one move to obtain sequence \\[0, 2\\] with .\n\nIn the second example the _gcd_ of the sequence is already greater than 1."}],"translated_statement":[{"iden":"statement","content":"Mike 有一个长度为 $n$ 的序列 $A = [a_1, a_2, ..., a_n]$。他定义序列 $B = [b_1, b_2, ..., b_n]$ 是美丽的，当且仅当它的所有元素的 $\\gcd$ 大于 $1$，即 $\\gcd(b_1, b_2, ..., b_n) > 1$。\n\nMike 希望通过操作将他的序列变为美丽的。在一次操作中，他可以选择一个索引 $i$（$1 \\leq i < n$），删除数字 $a_i, a_{i+1}$，并用 $a_i - a_{i+1}, a_i + a_{i+1}$ 替换它们，按此顺序放置。他希望尽可能少地执行操作。请找出使序列 $A$ 变得美丽的最少操作次数，如果不可能则告诉他无法做到。\n\n其中 $\\gcd$ 是最大的非负整数 $d$，使得 $d$ 能整除每个 $b_i$（$1 \\leq i \\leq n$）。\n\n第一行包含一个整数 $n$（$2 \\leq n \\leq 100\\,000$）——序列 $A$ 的长度。\n\n第二行包含 $n$ 个空格分隔的整数 $a_1, a_2, ..., a_n$（$1 \\leq a_i \\leq 10^9$）——序列 $A$ 的元素。\n\n如果可以通过上述操作使序列 $A$ 变得美丽，则在第一行输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"（不含引号）。\n\n如果答案是 \"_YES_\"，则输出使序列 $A$ 变得美丽的最少操作次数。\n\n在第一个例子中，你只需执行一次操作即可得到序列 $[0, 2]$，其 $\\gcd$ 为 $2$。\n\n在第二个例子中，序列的 $\\gcd$ 已经大于 $1$。"},{"iden":"input","content":"第一行包含一个整数 $n$（$2 \\leq n \\leq 100\\,000$）——序列 $A$ 的长度。第二行包含 $n$ 个空格分隔的整数 $a_1, a_2, ..., a_n$（$1 \\leq a_i \\leq 10^9$）——序列 $A$ 的元素。"},{"iden":"output","content":"如果可以通过上述操作使序列 $A$ 变得美丽，则在第一行输出 \"_YES_\"（不含引号），否则输出 \"_NO_\"（不含引号）。如果答案是 \"_YES_\"，则输出使序列 $A$ 变得美丽的最少操作次数。"},{"iden":"examples","content":"输入\n2\n1 1\n输出\nYES\n1\n\n输入\n3\n6 2 4\n输出\nYES\n0\n\n输入\n2\n1 3\n输出\nYES\n1"},{"iden":"note","content":"在第一个例子中，你只需执行一次操作即可得到序列 $[0, 2]$，其 $\\gcd$ 为 $2$。在第二个例子中，序列的 $\\gcd$ 已经大于 $1$。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ n \\geq 2 $, be the length of sequence $ A = (a_1, a_2, \\dots, a_n) $, where $ a_i \\in \\mathbb{Z} $ and $ 1 \\leq a_i \\leq 10^9 $.  \nA sequence $ B = (b_1, b_2, \\dots, b_n) $ is *beautiful* if $ \\gcd(b_1, b_2, \\dots, b_n) > 1 $.  \n\nAn operation consists of choosing an index $ i \\in \\{1, 2, \\dots, n-1\\} $, deleting $ (a_i, a_{i+1}) $, and replacing them with $ (a_i - a_{i+1}, a_i + a_{i+1}) $, in that order.  \n\n**Constraints**  \n1. $ 2 \\leq n \\leq 100{,}000 $  \n2. $ 1 \\leq a_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $  \n\n**Objective**  \nDetermine the minimal number of operations required to transform $ A $ into a beautiful sequence, or determine that it is impossible.  \n\nLet $ G = \\gcd(a_1, a_2, \\dots, a_n) $.  \nIf $ G > 1 $, then no operations are needed.  \nOtherwise, find the minimum number of operations such that the resulting sequence has $ \\gcd > 1 $.  \nIf impossible, output \"NO\".","simple_statement":null,"has_page_source":false}