Codeforces Round #720 Nastia and a Good Array - Java/C++
Solution:
Because we can change at most n numbers. And the new value at most can be $2\cdot 10^9$.
So, we replace all the number to two big prime numbers (except the minimum value): $10^9+7$ and $10^9+9$.