def main(): n = int(input()) l = [int(i) for i in input().split()] if len(l) != len(list(set(l))): print("NO") else: sorted_list = sorted(l) diff = sorted_list[1] - sorted_list[0] for i in range(len(sorted_list) - 1): if diff != sorted_list[i+1] - sorted_list[i]: print("NO") break print("YES") if __name__ == '__main__': main()