def gcd(a, b): while b: a, b = b, a % b return a from math import sqrt,ceil,floor def yaku(n):#nの約数を列挙するO(sqrt(n)) rev = [] for i in range(1,ceil(sqrt(n))+1): if n % i == 0: rev.append(i) if n //i == i: continue rev.append(n//i) rev = list(set(rev)) return sorted(rev) N = int(input()) A = list(map(int,input().split())) cnt = 0 newA = [] for a in A: if a != 0: newA.append(a) else: cnt += 1 def is_ok(d): tmp = 0 for i in range(len(newA)-1): if (newA[i+1] - newA[i]) % d == 0: tmp += (newA[i+1]-newA[i])//d else: print('Error') if tmp <= cnt: return True else: return False if newA == []: print('Yes') else: g = newA[0] for a in newA: g = gcd(g,a) ds = yaku(g) for d in ds: if is_ok(d): print('Yes') exit() print('No')