import sys import math def input(): return sys.stdin.read() def compute_gcd(arr): from math import gcd current_gcd = arr[0] for num in arr[1:]: current_gcd = gcd(current_gcd, num) if current_gcd == 0: break return current_gcd def factorize(n): factors = {} while n % 2 == 0: factors[2] = factors.get(2, 0) + 1 n = n // 2 i = 3 while i * i <= n: while n % i == 0: factors[i] = factors.get(i, 0) + 1 n = n // i i += 2 if n > 1: factors[n] = 1 return factors def get_divisors(n): if n == 0: return [] factors = factorize(n) divisors = [1] for p in factors: exponents = factors[p] temp = [] current_length = len(divisors) for e in range(1, exponents + 1): pe = p ** e for i in range(current_length): temp.append(divisors[i] * pe) divisors += temp divisors = list(set(divisors)) divisors.sort() return divisors def main(): data = input().split() N = int(data[0]) A = list(map(int, data[1:N+1])) S = [x for x in A if x != 0] if len(S) <= 1: print("Yes") return S.sort() diffs = [] for i in range(len(S)-1): diffs.append(S[i+1] - S[i]) g = compute_gcd(diffs) if g == 0: print("Yes") return divisors = get_divisors(g) max_x = S[-1] min_x = S[0] required_length = N for d in divisors: if d == 0: continue if (max_x - min_x) > (required_length - 1) * d: continue a = max_x - (required_length - 1) * d if a <= 0 or a > min_x: continue valid = True for x in S: delta = x - a if delta % d != 0: valid = False break t = delta // d if t < 0 or t >= required_length: valid = False break if valid: print("Yes") return print("No") if __name__ == "__main__": main()