// No.406 鴨等間隔の法則 // https://yukicoder.me/problems/no/406 // #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; string solve(vector ducks); int main() { int N; cin >> N; vector ducks; for (auto i = 0; i < N; i++) { int tmp; cin >> tmp; ducks.push_back(tmp); } string ans = solve(ducks); cout << ans << endl; } string solve(vector ducks) { sort(ducks.begin(), ducks.end()); int diff; diff = ducks[1] - ducks[0]; if (diff == 0) return "NO"; for (auto i = 2; i < ducks.size(); i++ ) { if (ducks[i] - ducks[i-1] != diff) return "NO"; } return "YES"; }