#C12045. Minimum Cost to Make a List Palindrome

    ID: 41429 Type: Default 1000ms 256MiB

Minimum Cost to Make a List Palindrome

Minimum Cost to Make a List Palindrome

Given a list of integers, your task is to compute the minimum number of changes required to make the list a palindrome. A list is called a palindrome if it reads the same backward as forward. For each pair of elements at positions i and n-i-1 (where n is the length of the list), if they are not equal, one change is needed.

The mathematical formulation is given by:

$$\text{Minimum Changes} = \sum_{i=0}^{\lfloor \frac{n}{2} \rfloor - 1} \begin{cases} 1, & \text{if } a_i \neq a_{n-i-1} \\ 0, & \text{otherwise} \end{cases}$$

Determine and output this minimum number.

inputFormat

The first line of input contains a single integer n representing the number of elements in the list. The second line contains n space-separated integers representing the elements of the list.

outputFormat

Output a single integer denoting the minimum number of changes required to convert the list into a palindrome.

## sample
7
1 2 3 4 3 2 1
0