contestada

There are N coins, each showing either heads or tails. We would like the number of coins showing heads to be equal to the number showing tails. What is the minimum number of coins that mmust be turned over?
Write a function:
int solution (vector &A);
that, given an array A consisting of N integers representing the coins,
returns the minimum number of coins that must be flipped.
Consecutive elements of array A represent consecutive coins, and contain either a 0 (heads) or a 1 (tails).
Examples:
1. Given array A = [1, 0, 0, 1, 0, 0], there are four coins showing heads and two showing tails. The function should return 1, as after reversing one of the coins showing heads, there will be three coins showing heads and three showing tails.