human
Minimize moves required to make array elements equal by incrementing and decrementing pairs | Set 2 | Function to find the minimum number of increment and decrement of pairs required to make all array elements equal.
Stores the sum of the array.
If sum is not divisible by N.
Update sum.
Store the minimum number of operations.
Iterate while i is less than N.
Add absolute difference of current element with k to ans.
Increase i bye 1.
Return the value in ans2.
Driver Code.
Given Input.
Function Call"
Solution in Python:

Give me a code to minimize moves required to make array elements equal by incrementing and decrementing pairs and the other steps required?
assistant
#Here is code to minimize moves required to make array elements equal by incrementing and decrementing pairs and the other steps required.
 def find ( arr , N ) :
	Sum = sum ( arr )
	if Sum % N :
		return - 1
	else :
		k = Sum // N
		ans = 0
		i = 0
		while i < N :
			ans = ans + abs ( k - arr [ i ] )
			i += 1
		return ans // 2
if __name__ == ' _ _ main _ _ ' :
	arr = [ 5 , 4 , 1 , 10 ]
	N = len ( arr )
	print ( find ( arr , N ) )