#P10295. Opposite Hat Matching
Opposite Hat Matching
Opposite Hat Matching
Given an even integer representing the number of people sitting around a circular table, each wearing a hat with a number . The seats are numbered in clockwise order from to . Each person looks directly across the table at the person opposite them. Your task is to determine how many people see that the number on the hat of the person they are facing is the same as the number on their own hat.
Note: If two people facing each other have the same number, both are counted.
inputFormat
The input consists of two lines:
1. The first line contains an even integer , the number of people.
2. The second line contains space-separated integers , where is the number on the hat of the person sitting at seat .
outputFormat
Output a single integer representing the number of people who see the same hat number as their own.
sample
4
1 2 1 2
4