Time limit
2s
Memory limit
128 MB
N people are sitting around a circular table in clockwise order, and each person is drinking one brand of cola. Two people may form a toast pair only when both conditions below are satisfied.

In the picture, the left arrangement is possible because the connections do not cross, while the right arrangement is not possible. Given N and the cola brand of each person in clockwise order, find the maximum number of toast pairs that can be made at the same time.
The first line contains the number of people N (1 ≤ N ≤ 1000).
The second line contains N integers a_i (1 ≤ a_i ≤ 100), separated by spaces. The integers are given in clockwise order and represent the cola brand each person is drinking.
Print the maximum number of toast pairs that can be made at the same time.