#K40862. Minimum Operations to Equalize Array Elements
Minimum Operations to Equalize Array Elements
Minimum Operations to Equalize Array Elements
You are given an array of n integers. In one operation, you can select any two elements, A and B, and replace them with |A - B|
and A + B
. The task is to determine the minimum number of operations required to make all elements in the array equal.
It can be mathematically shown that the answer is always n - 1, where n is the number of elements in the array. This problem tests your understanding of basic arithmetic operations and input/output processing.
Note: The operations described are only for conceptual understanding. For the purpose of this problem, you do not need to simulate the operations as the answer directly depends on the number of elements in the array.
inputFormat
The first line contains a single integer n, the number of elements in the array.
The second line contains n space-separated integers representing the elements of the array.
Input is read from standard input (stdin).
outputFormat
Output a single integer representing the minimum number of operations required to make all elements equal. Output is written to standard output (stdout).
## sample3
1 3 2
2
</p>