using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); // Test(); } static void Solve() { var n = NN; var a = NList; WriteLine(Card(n, a) ? "Yes" : "No"); } static bool Card(int n, long[] a) { if (n == 2) return true; var nonzero = a.Where(ai => ai != 0).ToList(); if (nonzero.Count == 0) { return true; } nonzero.Sort(); var dlist = new List(); for (var i = 0; i + 1 < nonzero.Count; ++i) dlist.Add(nonzero[i + 1] - nonzero[i]); if (dlist.Any(d => d == 0)) { return nonzero[0] == nonzero[^1]; } var gcd = dlist[0]; for (var i = 1; i < dlist.Count; ++i) gcd = GCD(gcd, dlist[i]); var zerocount = (long)n - nonzero.Count; foreach (var d in dlist) { zerocount -= d / gcd - 1; if (zerocount < 0) { return false; } } return true; } static long GCD(long a, long b) { if (a < b) return GCD(b, a); if (a % b == 0) return b; return GCD(b, a % b); } }