import java.util.ArrayList; import java.util.Scanner; import java.util.TreeSet; public class Kamo { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); boolean tof = true; ArrayList x = new ArrayList<>(); for(int i = 0;i < N;i++){ int k = s.nextInt(); if(!x.contains(k)){ x.add(k); }else{ tof = false; } } s.close(); if(tof){ TreeSet y = new TreeSet<>(); y.addAll(x); int p = y.pollFirst(); final int d = y.first() - p; p = y.pollFirst(); while(y.size() != 0){ if(y.first() -p != d){ tof = false; break; } p = y.pollFirst(); } } if(tof){ System.out.println("YES"); }else{ System.out.println("NO"); } } }