import math def main(): import sys input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) S = [x for x in A if x > 0] if len(S) == 0: print("Yes") return if len(S) == 1: print("Yes") return S.sort() base = S[0] diffs = [] for x in S[1:]: diffs.append(x - base) from math import gcd g = 0 for d in diffs: g = gcd(g, d) if g == 0: print("Yes") return def get_divisors(g_val): if g_val == 0: return [] divisors = set() for i in range(1, int(math.isqrt(g_val)) + 1): if g_val % i == 0: divisors.add(i) divisors.add(g_val // i) return sorted(divisors) divisors = get_divisors(g) found = False for d in divisors: r = S[0] % d valid = True for x in S: if x % d != r: valid = False break if not valid: continue x_r_list = [(x - r) // d for x in S] lower_bound_m = max(x_r - (N - 1) for x_r in x_r_list) upper_bound_m = min(x_r_list) if lower_bound_m > upper_bound_m: continue a_max = r + upper_bound_m * d if a_max > S[0]: continue a_min = r + lower_bound_m * d if (a_min + (N - 1) * d) < S[-1]: continue found = True break print("Yes" if found else "No") if __name__ == "__main__": main()