#!/usr/bin/env python #coding:UTF-8 N = int(raw_input()) x1 = map(int,raw_input().split()) x2 = sorted(x1) calc = x2[1] - x2[0] judge = "YES" for I in range(2,N): calc2 = x2[I] - x2[I - 1] if calc2 == 0 or calc != calc2: judge = "NO" print judge