N = input() List = [] w = raw_input() w_split = w.split() for i in range(0,N): List.append(int(w_split[i])) List.sort() A = List B = A[:] LL =[] for i in range(0,N-1): LL.append(abs(B[i]-A[i+1])) if len(set(LL)) == 1 and len(List) == len(set(List)): print 'YES' else: print 'NO'