Mike has a sequence A = [a1, a2, ..., an] of length n. He considers the sequence B = [b1, b2, ..., bn] beautiful if the gcd of all its elements is bigger than 1, i.e. <image>. 

Mike 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 ai, ai + 1 and put numbers ai - ai + 1, ai + ai + 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.

<image> is the biggest non-negative number d such that d divides bi for every i (1 ≤ i ≤ n).

Input

The first line contains a single integer n (2 ≤ n ≤ 100 000) — length of sequence A.

The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — elements of sequence A.

Output

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.

If the answer was "YES", output the minimal number of moves needed to make sequence A beautiful.

Examples

Input

2
1 1


Output

YES
1


Input

3
6 2 4


Output

YES
0


Input

2
1 3


Output

YES
1

Note

In the first example you can simply make one move to obtain sequence [0, 2] with <image>.

In the second example the gcd of the sequence is already greater than 1.

Difficulty: MEDIUM_HARD

Solutions:
def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
n = int(input())
a = list(map(int, input().split()))
ans = 0
l = 0
g = a[0]
for i in range(n):
	g = gcd(a[i], g)
if g > 1:
	print('YES\n0')
else:
	for i in range(n):
		if a[i] % 2:
			l += 1
		else:
			if l % 2:
				ans += l // 2 + 2
			else:
				ans += l // 2
			l = 0
	if l % 2:
		ans += l // 2 + 2
	else:
		ans += l // 2
	print('YES')
	print(ans)


import sys
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(int)
import math as mt
n = I()
l = L()
g = 0
c = 0
for i in range(n):
	g = mt.gcd(g, l[i])
	if l[i] % 2 == 1:
		c += 1
if g > 1:
	print('YES')
	print(0)
else:
	a = 0
	i = 0
	f = 0
	if len(set(l)) == 1 and list(set(l))[0] == 0:
		print('NO')
	else:
		while i < n - 1:
			if l[i] % 2 == 1 and l[i + 1] % 2 == 1:
				a += 1
				l[i] += 1
				l[i + 1] += 1
				i += 2
			else:
				i += 1
		i = 0
		while i < n - 1:
			if l[i] % 2 == 1 and l[i + 1] % 2 == 0:
				a += 2
				i += 2
			elif l[i] % 2 == 0 and l[i + 1] % 2 == 1:
				a += 2
				i += 2
			else:
				i += 2
		if i == n - 1 and l[i] % 2 == 1:
			a += 2
		print('YES')
		print(a)


from math import gcd
n = int(input())
arr = [int(x) for x in input().split()]
GCD = 0
for i in range(n):
	GCD = gcd(arr[i], GCD)
if GCD > 1:
	print('YES')
	print(0)
else:
	ans = 0
	for i in range(1, n):
		if arr[i - 1] % 2 != 0 and arr[i] % 2 != 0:
			(arr[i - 1], arr[i]) = (arr[i - 1] - arr[i], arr[i - 1] + arr[i])
			ans += 1
	GCD = 0
	for i in range(n):
		GCD = gcd(arr[i], GCD)
	if GCD > 1:
		print('YES')
		print(ans)
	else:
		for i in range(n):
			if arr[i] % 2 != 0:
				ans += 2
		print('YES')
		print(ans)


def gcd(a, b):
	while a != b and a != 0 and (b != 0):
		if a > b:
			a = a % b
		else:
			b = b % a
	if a == 0:
		return b
	if b == 0:
		return a
	return a
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
d = b[0]
for i in range(1, n):
	d = gcd(d, b[i])
	if d == 1:
		break
if d != 1:
	print('YES')
	print(0)
	exit()
odd = 0
ans = 0
for i in range(0, n):
	if a[i] % 2 == 0:
		if odd > 0:
			ans += odd // 2 + (2 if odd % 2 == 1 else 0)
		odd = 0
	else:
		odd += 1
if odd > 0:
	ans += odd // 2 + (2 if odd % 2 == 1 else 0)
print('YES')
print(ans)


import math
n = input()
s = map(int, input().split())
res = cur = g = 0
for x in s:
	g = math.gcd(x, g)
	if x & 1 == 0:
		res += math.ceil(cur / 2) + (cur & 1)
		cur = 0
	else:
		cur += 1
res += math.ceil(cur / 2) + (cur & 1)
print('YES')
if g == 1:
	print(res)
else:
	print('0')


from sys import exit

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)
print('YES')
n = int(input())
s = []
mn = float('inf')
for i in input().split():
	i = int(i)
	if i < mn:
		mn = i
	s.append(i)
g = s[0]
for i in s[1:]:
	g = gcd(g, i)
	if g == 1:
		break
else:
	print(0)
	exit()
count = 0
last = s[0] % 2
for i in s[1:]:
	if i % 2:
		if last:
			count += 1
			last = 0
		else:
			last = 1
	elif last:
		count += 2
		last = 0
if last:
	count += 2
print(count)


import math
n = int(input())
lis = list(map(int, input().split()))
gc = lis[0]
c = 0
for i in range(1, n):
	if math.gcd(gc, lis[i]) == 1:
		c = 1
print('YES')
if c == 0:
	print('0')
else:
	ans = 0
	c = 0
	for i in lis:
		if i % 2 != 0:
			c += 1
		else:
			ans += c // 2 + 2 * (c % 2)
			c = 0
	ans += c // 2 + 2 * (c % 2)
	print(ans)


from math import gcd
n = int(input())
a = [int(i) for i in input().split()]
g = 0
cnt = 0
ans = 0
for v in a:
	g = gcd(g, v)
	if v & 1:
		cnt += 1
	else:
		ans += cnt // 2 + 2 * (cnt & 1)
		cnt = 0
ans += cnt // 2 + 2 * (cnt & 1)
print('YES')
if g == 1:
	print(ans)
else:
	print(0)


import math
from functools import reduce
n = int(input())
s = input().split()
A = [int(i) for i in s]
L = A.copy()
gcd = reduce(lambda x, y: math.gcd(x, y), L)
if gcd != 1:
	print('YES\n' + '0')
else:
	d = 0
	for i in range(len(A) - 1):
		if A[i] % 2 == 1 and A[i + 1] % 2 == 1:
			a = A[i]
			A[i] = a - A[i + 1]
			A[i + 1] = a + A[i + 1]
			d += 1
	h = 0
	while h < len(A) and A[h] % 2 == 0:
		h += 1
	if h < len(A):
		t = d
		for i in range(len(A) - 1):
			if A[i] % 2 == 1 or A[i + 1] % 2 == 1:
				a = A[i]
				A[i] = a - A[i + 1]
				A[i + 1] = a + A[i + 1]
				a = A[i]
				A[i] = a - A[i + 1]
				A[i + 1] = a + A[i + 1]
				d += 2
		if t == d:
			print('NO')
		else:
			print('YES\n' + str(d))
	else:
		print('YES\n' + str(d))


import os
import sys
from math import *
from collections import *
from functools import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcde'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = array()
gc = reduce(gcd, a)
a = [i for i in range(n) if a[i] % 2]
ans = 0
i = 0
while i < len(a) - 1:
	d = a[i + 1] - a[i]
	if d == 1:
		ans += 1
		a[i] = a[i + 1] = -inf
	else:
		i -= 1
	i += 2
ans += 2 * (len(a) - a.count(-inf))
if gc > 1:
	ans = 0
print('YES')
print(ans)


import sys, os, io
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from bisect import bisect_right, bisect_left
import math

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = 1

def ise(n):
	return abs(1 - n % 2)

def iso(n):
	return abs(n % 2)
for _ in range(t):
	n = ii()
	a = li()
	g = a[0]
	for i in a:
		g = gcd(g, i)
	if g > 1:
		print('YES')
		print(0)
	else:
		res = 0
		for i in range(1, n):
			if iso(a[i]) and iso(a[i - 1]):
				res += 1
				a[i] = 0
				a[i - 1] = 0
				continue
		for i in a:
			if iso(i):
				res += 2
		print('YES')
		print(res)


def gcd(a, b):
	while b != 0:
		if a < b:
			(a, b) = (b, a)
		(a, b) = (b, a % b)
	return a

def main():
	n = int(input())
	a = list(map(int, input().split()))
	b = a[:]
	a.sort()
	for i in range(n - 1):
		if gcd(a[i], a[i + 1]) == 1:
			break
	else:
		print('YES\n0')
		return
	result = 0
	a = [0 if item % 2 == 0 else 1 for item in b]
	for i in range(n - 1):
		if a[i] == 1 and a[i + 1] == 1:
			(a[i], a[i + 1]) = (0, 0)
			result += 1
	for i in range(n - 1):
		if a[i] == 1:
			result += 2
	if a[-1] == 1:
		result += 2
	print('YES\n%d' % result)
main()


import math
N = int(input())
A = list(map(int, input().split()))

def mygcd(a, b):
	a = abs(a)
	b = abs(b)
	if a == 0 or b == 0:
		return max(a, b)
	return math.gcd(a, b)
tmp = A[0]
for i in range(1, N):
	tmp = mygcd(tmp, A[i])
if tmp > 1:
	print('YES')
	print('0')
	exit()
ans = 0
for i in range(N - 1):
	if A[i] % 2 == 0:
		continue
	tmp = 0
	if A[i] % 2 == 0:
		tmp += 1
	if A[i + 1] % 2 == 0:
		tmp += 1
	if tmp == 0:
		ans += 1
		A[i + 1] = A[i] + A[i + 1]
	elif tmp == 1:
		ans += 2
		A[i + 1] = A[i] * 2
	else:
		continue
if A[-1] % 2 != 0:
	ans += 2
print('YES')
print(ans)


import math
n = int(input())
sec = [int(i) for i in input().split()]
print('YES')
ans = 0
gg = math.gcd(sec[0], sec[1])
for i in range(2, n):
	gg = math.gcd(gg, sec[i])
if gg > 1:
	print(0)
else:
	for i in range(0, n - 1):
		if sec[i] % 2 == 1 and sec[i + 1] % 2 == 1:
			sec[i] = sec[i + 1] = 2
			ans += 1
	for i in sec:
		ans += i % 2 * 2
	print(ans)


import math
t = int(input())
k = list(map(int, input().split()))
s = ''
su = 0
pro = -1
gc = 0
for i in k:
	gc = math.gcd(i, gc)
if gc > 1:
	print('YES')
	print(0)
	exit()
else:
	print('YES')
	for i in range(t):
		s += str(k[i] % 2)
	d = list(s.split('0'))
	for i in d:
		su += int((len(i) + 1) / 2) + len(i) % 2
	print(su)


import math
n = int(input())
mylist = [int(i) for i in input().split()]
binlist = []
j = 0
while j < n:
	l = []
	while j < n and mylist[j] % 2 == 1:
		l.append(mylist[j])
		j += 1
	binlist.append(l)
	j += 1
mygcd = 0
ans = 0
for i in mylist:
	mygcd = math.gcd(mygcd, i)
if mygcd == 1:
	for i in binlist:
		if len(i) % 2 == 0:
			ans += len(i) / 2
		else:
			ans += (len(i) + 1) / 2 + 1
print('YES')
print(int(ans))


def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a

def gcd_list(l):
	n = len(l)
	if n == 1:
		return l[0]
	return gcd(gcd_list(l[0:n // 2]), gcd_list(l[n // 2:]))
n = int(input().strip())
a = [int(x) for x in input().strip().split()]
print('YES')
if gcd_list(a) > 1:
	print(0)
else:
	a.append(0)
	ops = 0
	odds = 0
	for x in a:
		if x % 2 == 1:
			odds += 1
		elif odds > 0:
			ops += odds // 2 + (2 if odds % 2 == 1 else 0)
			odds = 0
	print(ops)


def gcd(a, b):
	if not a or not b:
		return max(a, b)
	if a % b == 0:
		return b
	return gcd(b, a % b)
n = int(input())
a = list(map(int, input().split()))
now = a[0]
for i in range(1, n):
	now = gcd(now, a[i])
if now != 1:
	print('YES\n0')
else:
	res = 0
	i = 0
	while i < n:
		if a[i] & 1:
			if i < n - 1 and a[i + 1] & 1:
				res += 1
				i += 2
			else:
				res += 2
				i += 1
		else:
			i += 1
	print('YES\n' + str(res))


import math

def div(x):
	global d
	for u in range(2, math.floor(math.sqrt(x)) + 1):
		if x % u == 0:
			d.add(u)
			while x % u == 0:
				x //= u
	if x != 1:
		d.add(x)
n = int(input())
d = set()
a = list(map(int, input().split()))
div(a[0])
s = set()
for i in range(1, n):
	for j in d:
		if a[i] % j != 0:
			s.add(j)
if d.difference(s):
	print('YES\n0')
else:
	k = 0
	for i in range(n - 1):
		if a[i] % 2 == 1 or i == n - 2:
			if a[i] % 2 == 1 and a[i + 1] % 2 == 1:
				tmp = a[i]
				a[i] -= a[i + 1]
				a[i + 1] += tmp
				k += 1
			elif a[i] % 2 == 0 and a[i + 1] % 2 == 1 or (a[i + 1] % 2 == 0 and a[i] % 2 == 1):
				tmp = a[i]
				a[i] = -2 * a[i + 1]
				a[i + 1] = 2 * tmp
				k += 2
	print('YES')
	print(k)


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	prev = 0
	for i in arr:
		prev = math.gcd(prev, i)
	if prev > 1:
		print('YES')
		print(0)
		return
	if n == 2:
		if arr[0] % 2 != 0 and arr[1] % 2 != 0:
			print('YES')
			print(1)
		elif arr[0] % 2 == 0 and arr[1] % 2 == 0:
			print('YES')
			print(0)
		else:
			print('YES')
			print(2)
		return
	count = 0
	for i in range(1, n - 1):
		if arr[i] % 2 != 0:
			if arr[i - 1] % 2 != 0:
				count += 1
				(arr[i - 1], arr[i]) = (abs(arr[i] - arr[i - 1]), arr[i - 1] + arr[i])
			elif arr[i + 1] % 2 != 0:
				count += 1
				(arr[i], arr[i + 1]) = (abs(arr[i] - arr[i + 1]), arr[i] + arr[i + 1])
	for i in arr:
		if i % 2 != 0:
			count += 2
	print('YES')
	print(count)
t = 1
for _ in range(t):
	solve()


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
a = [int(i) for i in input().split()]
g = 0
count = 0
result = 0
for p in a:
	g = gcd(g, p)
	if p & 1:
		count += 1
	else:
		result += count // 2 + 2 * (count & 1)
		count = 0
result += count // 2 + 2 * (count & 1)
print('YES')
if g == 1:
	print(result)
else:
	print(0)


def main():
	from math import gcd
	input()
	aa = list(map(int, input().split()))
	g = aa[-1]
	for a in aa:
		g = gcd(a, g)
		if g == 1:
			break
	else:
		print('YES\n0')
		return
	r = t = 0
	for a in aa:
		if t:
			r += 2 - (a & 1)
			t = 0
		else:
			t = (a & 1) * 2
	print('YES', r + t, sep='\n')
main()


(s, i, n) = (0, 0, int(input()))
t = list(map(int, input().split())) + [0]
while i < n:
	if t[i] % 2:
		i += 1
		s += 2 - t[i] % 2
	i += 1
b = t[0]
for a in t:
	while a:
		(a, b) = (b % a, a)
	if b == 1:
		break
print('YES')
if b > 1:
	print(0)
else:
	print(s)


from math import gcd

def func(a):
	x = a[0]
	for i in range(1, len(a)):
		x = gcd(a[i], x)
	return x
n = int(input())
a = [int(x) for x in input().split()]
if func(a) > 1:
	print('YES')
	print(0)
else:
	a = [int(x) % 2 for x in a]
	an = 0
	for i in range(n - 1):
		if a[i] == 1:
			if a[i + 1] == 1:
				an += 1
			else:
				an += 2
			(a[i], a[i + 1]) = (0, 0)
	if a[-1] == 1:
		an += 2
	print('YES')
	print(an)


import math

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	g = 0
	for i in range(n):
		g = math.gcd(max(arr[i], g), min(arr[i], g))
		arr[i] = arr[i] % 2
	if g > 1:
		print('YES')
		print(0)
		return
	moves = 0
	for i in range(n - 1):
		if arr[i] == 1 and arr[i + 1] == 1:
			moves += 1
			arr[i] = 0
			arr[i + 1] = 0
		elif arr[i] == 1 and arr[i + 1] == 0:
			moves += 2
			arr[i] = 0
	if arr[-1] == 1:
		moves += 2
	print('YES')
	print(moves)
main()


from functools import reduce
N = int(input())
A = list(map(int, input().split()))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
print('YES')
if reduce(gcd, A) > 1:
	print(0)
else:
	ans = 0
	for i in range(N - 1):
		while A[i] & 1:
			ans += 1
			(A[i], A[i + 1]) = (A[i] - A[i + 1], A[i] + A[i + 1])
	if A[N - 1] & 1:
		ans += 2
	print(ans)


n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
k = 0
g = 0

def gcd(c, d):
	if c % d == 0:
		return d
	else:
		return gcd(d, c % d)
while True:
	for i in range(n):
		g = gcd(g, a[i])
	if g > 1:
		k = 0
		break
	else:
		for i in range(n - 1):
			if a[i] % 2 != 0 and a[i + 1] % 2 != 0:
				k += 1
				a[i] = a[i + 1] = 2
			else:
				pass
		for i in range(n):
			if a[i] % 2 != 0:
				k += 2
				a[i] = 2
		break
print('YES')
print(k)


from sys import stdin, stdout

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	elif a == b:
		return a
	else:
		while b:
			(a, b) = (b, a % b)
		return a

def seqGCD(a):
	currentGCD = gcd(a[0], a[1])
	i = 2
	n = len(a)
	while currentGCD != 1 and i < n:
		currentGCD = gcd(currentGCD, a[i])
		i += 1
	return currentGCD
n = int(stdin.readline().rstrip())
a = stdin.readline().rstrip().split()
a = [int(b) for b in a]
if seqGCD(a) > 1:
	print('YES')
	print(0)
else:
	moves = 0
	i = 0
	while i + 1 < n:
		if a[i] % 2 == 0:
			i += 1
		elif a[i + 1] % 2 == 1:
			moves += 1
			i += 2
		else:
			moves += 2
			i += 2
	if i == n - 1 and a[i] % 2 == 1:
		moves += 2
	print('YES')
	print(moves)


import math
from functools import reduce
n = int(input())
numbers = [int(x) for x in input().split()]
print('YES')
gcd = reduce(math.gcd, numbers)
if gcd != 1:
	print(0)
else:
	ans = 0
	line_of_odds = 0
	for num in numbers:
		if num % 2 == 1:
			line_of_odds += 1
		else:
			ans += line_of_odds // 2 + 2 * (line_of_odds % 2)
			line_of_odds = 0
	ans += line_of_odds // 2 + 2 * (line_of_odds % 2)
	print(ans)


from math import gcd
n = int(input())
l = list(map(int, input().split()))
g = 0
for i in l:
	g = gcd(g, i)
if g > 1:
	print('YES')
	print(0)
	exit()
count = 0
for i in range(n):
	if l[i] % 2 != 0:
		try:
			if l[i + 1] % 2 != 0:
				count += 1
				l[i + 1] = l[i] + l[i + 1]
			else:
				count += 2
		except:
			continue
if l[-1] % 2 != 0:
	count += 2
print('YES')
print(count)


def GCD(a, b):
	return a if b == 0 else GCD(b, a % b)
n = int(input())
a = list(map(int, input().split()))
a.append(0)
g = 0
odds = 0
count = 0
for i in range(n + 1):
	g = GCD(a[i], g)
	if a[i] % 2 == 1:
		odds += 1
	else:
		count += odds // 2 + 2 * (odds % 2)
		odds = 0
print('YES')
print(0 if g > 1 else count)


from math import gcd
from time import sleep

def f(l):
	g = l[0]
	for c in l[1:]:
		g = gcd(g, c)
	if g != 0 and g != 1:
		print('YES')
		print('0')
		return
	cnt = 0
	i = 0
	while i < len(l) - 1:
		if l[i] % 2 == 1 or l[i + 1] % 2 == 1:
			if l[i] % 2 != 1 and i + 2 < len(l) and (l[i + 2] % 2 == 1):
				i += 1
			else:
				cnt += 1
				(l[i], l[i + 1]) = (l[i] + l[i + 1], l[i] - l[i + 1])
		else:
			i += 1
	g = l[0]
	for c in l[1:]:
		g = gcd(g, c)
	if g != 0 and g != 1:
		print('YES')
		print(cnt)
	else:
		print('NO')
T = input()
l = [int(x) for x in input().split()]
f(l)


n = int(input())
a = [*map(int, input().split())]
from math import gcd
from functools import reduce
g = reduce(gcd, a)
print('YES')
if g > 1:
	print(0)
else:
	ans = 0
	c = 0
	for i in a:
		if i & 1:
			c += 1
		else:
			ans += c // 2 + 2 * (c & 1)
			c = 0
	ans += c // 2 + 2 * (c & 1)
	print(ans)


def gcd(a, b):
	if a == 0:
		return b
	if b == 0:
		return a
	return gcd(b, a % b)

def gcd_of_list(a):
	a = a[::-1]
	partial_gcd = 0
	while a:
		partial_gcd = gcd(partial_gcd, a.pop())
	return partial_gcd

def get_odd_chunk_lengths(a):
	a = a[::-1]
	chunk_lengths_arr = []
	curr_chunk_length = 0
	while a:
		next_num = a.pop()
		if next_num % 2 == 1:
			curr_chunk_length += 1
		if next_num % 2 == 0 and curr_chunk_length != 0:
			chunk_lengths_arr.append(curr_chunk_length)
			curr_chunk_length = 0
	if curr_chunk_length != 0:
		chunk_lengths_arr.append(curr_chunk_length)
	return chunk_lengths_arr

def num_ops_to_evenify_odd_chunk(chunk_length):
	if chunk_length % 2 == 0:
		return chunk_length // 2
	else:
		return chunk_length // 2 + 2
input()
a = [int(i) for i in input().split()]
if gcd_of_list(a) > 1:
	print('YES')
	print(0)
else:
	print('YES')
	print(sum([num_ops_to_evenify_odd_chunk(chunk_length) for chunk_length in get_odd_chunk_lengths(a)]))


from sys import stdin, stdout
from math import *

def ri():
	return map(int, stdin.readline().split())

def GCD(a):
	ans = 0
	for e in a:
		ans = gcd(ans, e)
	return ans

def even(i):
	return (i + 1) % 2

def odd(i):
	return i % 2
n = int(input())
a = list(ri())
print('YES')
if GCD(a) > 1:
	print(0)
	exit()
count = 0
for i in range(n - 2):
	if even(a[i]):
		if even(a[i + 1]):
			continue
		elif odd(a[i + 2]):
			continue
		else:
			count += 2
			a[i + 1] += 1
	elif even(a[i + 1]):
		count += 2
		continue
	else:
		count += 1
		a[i + 1] += 1
if even(a[n - 2]) and even(a[n - 1]):
	pass
if even(a[n - 2]) and odd(a[n - 1]):
	count += 2
	pass
if even(a[n - 1]) and odd(a[n - 2]):
	count += 2
	pass
if odd(a[n - 2]) and odd(a[n - 1]):
	count += 1
	pass
print(count)


import math
n = int(input())
a = list(map(int, input().split()))
a.append(6)
j = 1
p = a[0]
while j < n:
	p = math.gcd(p, a[j])
	j += 1
if p > 1:
	print('YES')
	print(0)
else:
	s = 0
	j = 0
	while j < n:
		if a[j] % 2 == 0:
			j += 1
		elif a[j + 1] % 2 != 0:
			s += 1
			j += 2
		else:
			s += 2
			j += 2
	print('YES')
	print(s)


import sys
import math
import collections
import heapq
import decimal
input = sys.stdin.readline
n = int(input())
l = [int(i) for i in input().split()]
g = l[0]
for i in range(1, n):
	g = math.gcd(g, l[i])
if g != 1:
	print('YES')
	print(0)
else:
	c = 0
	for i in range(n):
		l[i] %= 2
	c1 = 0
	for i in range(n):
		if l[i] == 1:
			c1 += 1
		else:
			c += math.ceil(c1 / 2) + c1 % 2
			c1 = 0
	c += math.ceil(c1 / 2) + c1 % 2
	print('YES')
	print(c)


import sys

def gcd(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return max(a, b)

def listGcd(l):
	g = gcd(l[0], l[1])
	for i in l[2:]:
		if g == 1:
			return g
		g = gcd(g, i)
	return g
n = int(sys.stdin.readline())
A = [int(i) for i in sys.stdin.readline().split()]
if listGcd(A) != 1:
	print('YES')
	print(0)
else:
	count = 0
	canPair = False
	for i in range(n):
		if canPair and A[i] % 2 == 1:
			count += 1
			canPair = False
		elif canPair and A[i] % 2 == 0:
			count += 2
			canPair = False
		elif canPair == False and A[i] % 2 == 1:
			if i == n - 1:
				count += 2
			canPair = True
	print('YES')
	print(count)


from sys import stdin, stdout, maxsize
import math
R = lambda : stdin.readline().strip()
RL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))
output = lambda x: stdout.write(str(x) + '\n')
output_list = lambda x: output(' '.join(map(str, x)))
n = int(R())
a = RL(int)
output('YES')
gcd = math.gcd(a[0], a[1])
for i in range(2, n):
	gcd = math.gcd(gcd, a[i])
if gcd != 1:
	output(0)
	exit()
for i in range(n):
	a[i] = a[i] % 2
ctr = 0
ans = 0
for i in range(n):
	if a[i] == 0:
		ans += math.ceil(ctr / 2) + ctr % 2
		ctr = 0
	else:
		ctr += 1
ans += math.ceil(ctr / 2) + ctr % 2
output(ans)


def main():
	from math import gcd
	input()
	aa = list(map(int, input().split()))
	g = r = t = 0
	while aa and g != 1:
		a = aa.pop()
		if t:
			r += 2 - (a & 1)
			t = 0
		else:
			t = (a & 1) * 2
		g = gcd(a, g)
	for a in reversed(aa):
		if t:
			r += 2 - (a & 1)
			t = 0
		else:
			t = (a & 1) * 2
	print('YES', (r + t) * (g < 2), sep='\n')
main()


from math import gcd, ceil
n = int(input())
a = list(map(int, input().split(' ')))
ans = []
tmp = a[0]
for i in range(1, n):
	tmp = gcd(tmp, a[i])
if tmp > 1:
	print('YES')
	print(0)
else:
	j = 0
	while j < n:
		if a[j] % 2 == 0:
			j += 1
			continue
		p = j
		while p < len(a) and a[p] % 2 == a[j] % 2:
			p += 1
		ans.append(p - j)
		j = p
	_sum = 0
	for i in range(len(ans)):
		_sum += ceil(ans[i] / 2) + ans[i] % 2
	print('YES')
	print(_sum)


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd
n = int(input())
a = list(map(int, input().split()))
ck = 0
print('YES')
for i in a:
	ck = gcd(ck, i)
if ck != 1:
	print(0)
else:
	for i in range(n):
		a[i] = a[i] % 2
	ans = 0
	for i in range(n):
		if i != n - 1:
			if a[i] == 1 and a[i + 1] == 1:
				ans += 1
				a[i] = 0
				a[i + 1] = 0
			elif a[i] == 1:
				ans += 2
				a[i] = 0
		elif a[i] == 1:
			ans += 2
	print(ans)


from math import gcd
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	hcf1 = 0
	for i in range(n):
		hcf1 = gcd(hcf1, a[i])
	if hcf1 > 1:
		print('YES')
		print(0)
		continue
	count_odd = 0
	count = 0
	for i in range(n):
		if a[i] % 2 == 0:
			count += count_odd // 2
			count += count_odd % 2 * 2
			count_odd = 0
		else:
			count_odd += 1
	count += count_odd // 2
	count += count_odd % 2 * 2
	print('YES')
	print(count)


from math import gcd
from functools import reduce

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print('YES')
	if reduce(gcd, a) > 1:
		print(0)
	else:
		ans = 0
		for i in range(n - 1):
			while a[i] % 2 != 0:
				(a[i], a[i + 1]) = (a[i] - a[i + 1], a[i] + a[i + 1])
				ans += 1
		while a[-1] % 2 != 0:
			(a[-2], a[-1]) = (a[-2] - a[-1], a[-2] + a[-1])
			ans += 1
		print(ans)
main()


from functools import reduce

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def check(arr):
	if reduce(gcd, arr) == 1:
		return False
	return True
n = int(input())
new = list(map(int, input().split()))

def main(new, n):
	if n == 1:
		return 'NO'
	if check(new):
		return ('YES', 0)
	arr = [x % 2 for x in new]
	i = 0
	ans = 0
	while i < n:
		if i == n - 1:
			if arr[i] == 1:
				ans += 2
			return ('YES', ans)
		if arr[i] == 0:
			i += 1
			continue
		if arr[i] == 1:
			if arr[i + 1] == 0:
				ans += 2
				i += 2
			else:
				ans += 1
				i += 2
	return ('YES', ans)
(ver, x) = main(new, n)
print(ver)
if ver == 'YES':
	print(x)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a * a + b * b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
n = int(input())
l = list(map(int, input().split()))
s = 0
for i in range(n):
	s = math.gcd(l[i], s)
if s > 1:
	print('YES')
	print(0)
	sys.exit()
else:
	ans = 0
	odd = []
	even = []
	for i in range(n):
		if l[i] % 2 == 1:
			odd.append(i)
		else:
			even.append(i)
	i = 0
	print('YES')
	while i < len(odd):
		if i < len(odd) - 1 and abs(odd[i] - odd[i + 1]) == 1:
			ans += 1
			i += 1
		else:
			ans += 2
		i += 1
	print(ans)


from math import gcd, ceil
from sys import exit
from functools import reduce
n = int(input())
numbers = list(map(int, input().strip().split()))
cum_gcd = reduce(gcd, numbers, 0)
if cum_gcd > 1:
	print('YES', 0, sep='\n')
	exit(0)
numbers.append(0)
numbers = [element % 2 for element in numbers]
(ans, cur_count) = [0, 0]
for (index, val) in enumerate(numbers):
	if val == 1:
		cur_count += 1
	else:
		ans += ceil(cur_count / 2) + cur_count % 2
		cur_count = 0
print('YES', ans, sep='\n')


from math import gcd
import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
oo = 0
oe = 0
lol = 0
g = l[0]
for i in range(1, n):
	g = gcd(g, l[i])
	if g == 1:
		lol = 1
print('YES')
if lol == 0:
	print(0)
else:
	cou = 0
	if l[0] % 2 and l[1] % 2 == 0:
		cou = 2
	for i in range(1, n):
		if l[i] % 2 and l[i - 1] % 2:
			l[i] = 2
			l[i - 1] = 2
			cou += 1
		elif l[i] % 2 and l[i - 1] % 2 == 0:
			if i + 1 < n and l[i + 1] % 2:
				continue
			else:
				l[i] = 2
				l[i - 1] = 2
				cou += 2
	print(cou)


from math import gcd
n = int(input())
a = list(map(int, input().split()))
print('YES')
g = 0
for x in a:
	g = gcd(g, x)
if g > 1:
	print(0)
else:
	ans = 0
	for i in range(n - 1):
		while a[i] % 2 == 1:
			(a[i], a[i + 1]) = (a[i] - a[i + 1], a[i] + a[i + 1])
			ans += 1
	if a[-1] % 2 == 1:
		ans += 2
	print(ans)


from math import gcd
n = int(input())
a = [int(i) for i in input().split()]
g = 0
count = 0
result = 0
for p in a:
	g = gcd(g, p)
	if p & 1:
		count += 1
	else:
		result += count // 2 + 2 * (count & 1)
		count = 0
result += count // 2 + 2 * (count & 1)
print('YES')
if g == 1:
	print(result)
else:
	print(0)


import math
n = input()
s = list(map(int, input().split()))
(res, cur, g) = (0, 0, 0)
for i in s:
	g = math.gcd(i, g)
	if i % 2 == 0:
		res += (cur + 1) // 2 + cur % 2
		cur = 0
	else:
		cur += 1
res += (cur + 1) // 2 + cur % 2
print('YES')
print(res if g == 1 else 0)


from math import gcd

def solve():
	n = int(input())
	a = list(map(int, input().split(' ')))
	if n == 1:
		return 0
	g = gcd(a[0], a[1])
	for i in range(2, len(a)):
		g = gcd(g, a[i])
		if g == 1:
			break
	if g > 1:
		return 0
	score = 0
	i = 0
	while i < len(a):
		if a[i] % 2 == 0:
			i += 1
			continue
		if a[i] % 2 == 1:
			if i == len(a) - 1:
				score += 2
				break
			if a[i + 1] % 2 == 1:
				score += 1
				i += 2
			else:
				score += 2
				i += 2
	return score
x = solve()
if x >= 0:
	print('YES')
	print(x)
else:
	print('NO')


from math import gcd
import sys
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().split()))
print('YES')
g = 0
for x in arr:
	g = gcd(g, x)
if g > 1:
	print(0)
else:
	arr.append(0)
	(c, an) = (0, 0)
	for x in arr:
		if x & 1:
			c += 1
		else:
			an += (c + 1 >> 1) + (c & 1)
			c = 0
	print(an)


n = int(input())
k = 0
l = list(map(int, input().split()))
a = l[0]
c = 0
for i in range(1, n):
	b = l[i]
	while a % b != 0:
		ost = a % b
		a = b
		b = ost
	if b == 1:
		c = 1
		break
	else:
		a = b
if c == 0:
	print('YES')
	print(0)
	exit()
k = 0
for i in range(n - 1):
	if l[i] % 2 != 0:
		if l[i + 1] % 2 != 0:
			k = k + 1
			l[i + 1] = 0
		else:
			k = k + 2
if l[n - 1] % 2 != 0:
	k = k + 2
print('YES')
print(k)


import math
n = int(input())
arr = list(map(int, input().split()))
gcd = 0
cur = 0
rel = 0
for ele in arr:
	gcd = math.gcd(gcd, ele)
	if ele % 2 == 0:
		rel += math.ceil(cur / 2) + cur % 2
		cur = 0
	else:
		cur += 1
rel += math.ceil(cur / 2) + cur % 2
print('YES')
if gcd == 1:
	print(rel)
else:
	print('0')


n = int(input())
al = list(map(int, input().split()))

def pgcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def pgcdl(l):
	if len(l) == 0:
		return -1
	if len(l) == 1:
		return l[0]
	p = pgcd(l[0], l[1])
	for i in l[2:]:
		if p == 1:
			break
		p = pgcd(p, i)
	return p
ret = 0
if pgcdl(al) == 1:
	for i in range(n):
		if al[i] % 2 == 1:
			if i == n - 1:
				ret += 2
			elif al[i + 1] % 2 == 1:
				ret += 1
				al[i + 1] = 0
			else:
				ret += 2
				al[i + 1] = 0
print('YES')
print(ret)


import math
length = int(input())
inp = input().split()
seq = []
for i in inp:
	seq += [int(i)]
if len(seq) != length:
	raise Exception('wrong input')

def gcd_of(a, b):
	if b == 0:
		return a
	else:
		q = math.floor(a / b)
		r = a - q * b
		return gcd_of(b, r)
gcd = 0
for number in seq:
	gcd = gcd_of(number, gcd)
if gcd != -1 and gcd != 1:
	print('YES')
	print(0)
else:
	odd = 0
	for i in seq:
		if i % 2 == 1:
			odd += 1
		elif odd % 2 == 1:
			odd += 3
	if odd % 2 == 1:
		odd += 3
	move_cnt = int(odd / 2)
	print('YES')
	print(move_cnt)


from sys import stdin

def gcd(a, b):
	if b:
		return gcd(b, a % b)
	else:
		return a
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
g = 0
for el in a:
	g = gcd(g, el)
res = 0
if g == 1:
	for i in range(n - 1):
		if a[i] % 2 and a[i + 1] % 2:
			(a[i], a[i + 1]) = (a[i] - a[i + 1], a[i] + a[i + 1])
			res += 1
	for i in range(n):
		if a[i] % 2:
			res += 2
print('YES')
print(res)


from functools import reduce

def odd_count(arr):
	return sum((a % 2 for a in arr))

def count_moves(arr):
	return odd_components(arr)

def odd_components(arr):
	parity = 0
	num_odd_components = 0
	odd_moves = 0
	odd_comp_size = 0
	for a in arr:
		parity = (parity + a) % 2
		if a == 1:
			odd_comp_size += 1
		if a == 0:
			odd_moves += odd_comp_size // 2 + 2 * (odd_comp_size % 2)
			odd_comp_size = 0
	odd_moves += odd_comp_size // 2 + 2 * (odd_comp_size % 2)
	return odd_moves

def gdc(a, b):
	return b if a % b == 0 else gdc(b, a % b)

def array_gdc(arr):
	return reduce(gdc, arr)
seq_size = int(input())
A = [int(x) for x in input().split(' ')]
d = array_gdc(A)
if d > 1:
	print('YES\n0')
else:
	A = [a % 2 for a in A]
	print('YES\n' + str(count_moves(A)))


from math import gcd
x = int(input())
s = list(map(int, input().split()))
gc = s[0]
for n in range(1, x):
	gc = gcd(gc, s[n])
if gc > 1:
	print('YES')
	print(0)
	exit(0)
res = 0
for n in range(x - 1):
	if s[n] % 2 and s[n + 1] % 2:
		res += 1
		a = s[n] - s[n + 1]
		b = s[n] + s[n + 1]
		s[n] = a
		s[n + 1] = b
for n in s:
	if n % 2:
		res += 2
print('YES')
print(res)


import re
from math import gcd

class Solution(object):

	def sol(self):
		n = int(input())
		nums = [int(i) for i in input().split()]
		s = ''
		g = 0
		for i in range(n):
			g = gcd(g, nums[i])
			s += '0' if nums[i] % 2 == 0 else '1'

		def gcdi(id):
			if id == n - 1:
				return nums[n - 1]
			else:
				return gcd(gcdi(id + 1), nums[id])
		ones = re.split('0+', s)
		res = 0
		for s1 in ones:
			res += len(s1) // 2 if len(s1) % 2 == 0 else len(s1) // 2 + 2
		print('YES')
		if g > 1:
			print('0')
		else:
			print(res)
so = Solution()
so.sol()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
n = val()
l = li()
gc = 0
for i in l:
	gc = math.gcd(gc, i)
print('YES')
if gc > 1:
	print(0)
	exit()
dp = [[0] * 2 for i in range(n + 1)]
dp[n][0] = 0
dp[n][1] = 2
for i in range(n - 1, -1, -1):
	dp[i][0] = min(dp[i + 1][1], 2 + dp[i + 1][0]) if l[i] & 1 else dp[i + 1][0]
	dp[i][1] = dp[i + 1][0] + (1 if l[i] & 1 else 2)
print(dp[1][l[0] & 1])


import math
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
	ans = math.gcd(ans, a[i])
if ans > 1:
	print('YES')
	print(0)
if ans == 1:
	cnt = 0
	i = 0
	while i < n:
		if a[i] % 2:
			if i < n - 1 and a[i + 1] % 2:
				cnt += 1
			else:
				cnt += 2
			if i == n - 1 or a[i + 1] % 2 == 0:
				i += 1
			else:
				i += 2
		else:
			i += 1
	print('YES')
	print(cnt)


import sys
input = sys.stdin.readline
n = int(input())
bits = []
g = 0

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
for i in map(int, input().split()):
	bits.append(i % 2)
	g = gcd(i, g)
if g > 1:
	print('YES')
	print('0')
else:
	cnt = 0
	for i in range(n - 1):
		if bits[i]:
			if bits[i + 1]:
				bits[i] = 0
				bits[i + 1] = 0
				cnt += 1
			else:
				bits[i] = 0
				cnt += 2
	if bits[n - 1]:
		cnt += 2
	print('YES')
	print(cnt)


import math
import sys
from bisect import bisect_right, bisect_left, insort_right
from collections import Counter, defaultdict
from heapq import heappop, heappush
from itertools import accumulate, permutations, combinations
from sys import stdout
R = lambda : map(int, input().split())
n = int(input())
a = list(R())
g = a[0]
for x in a[1:]:
	g = math.gcd(g, x)
if g > 1:
	print('YES')
	print(0)
	exit(0)
cnt = 0
i = 0
while i < n:
	if a[i] % 2:
		cnt += 1 if i < n - 1 and a[i + 1] % 2 else 2
		i += 1 if i == n - 1 or a[i + 1] % 2 == 0 else 2
	else:
		i += 1
print('YES')
print(cnt)


def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if a % b == 0:
		return b
	return gcd(b, a % b)
n = int(input())
a = list(map(int, input().split()))
k = gcd(a[0], a[1])
if n > 2:
	for i in a[2:]:
		k = gcd(k, i)
print('YES')
if k > 1:
	print(0)
else:
	(s, t) = (0, 0)
	for i in a:
		if i % 2 == 1:
			s += 1
		else:
			if s % 2 == 0:
				t += s // 2
			else:
				t += s // 2 + 2
			s = 0
	if s % 2 == 0:
		t += s // 2
	else:
		t += s // 2 + 2
	print(t)