import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class No00000406_Main2 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); String[] strArr = br.readLine().split(" "); int[] arr = new int[n]; for(int i = 0; i < n; i++) arr[i] = Integer.parseInt(strArr[i]); Arrays.sort(arr); int dist = arr[1] - arr[0]; for(int i = 0; i < n - 1; i++) { if(arr[i] == arr[i + 1] || dist != arr[i + 1] - arr[i]) { System.out.println("NO"); return; } } System.out.println("YES"); } }