import sequtils, strutils, algorithm var n = readLine(stdin).parseInt x = readLine(stdin).split.map(parseInt) x = x.map(proc(y:int):int = y - min(x)) sort(x, cmp[int]) proc main():string = if len(x) != len(deduplicate(x)): return "NO" var m = x[1] - x[0] for i,v in x: if i <= 1: continue if v - x[i - 1] == m: continue else: return "NO" return "YES" echo main()