Hat Circle
InterviewTime limit1sMemory limit1024 MB
Given N people in a circle with hat numbers, count how many people have the same hat number as the person directly across from them.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
At a recent social gathering, people sit around a circular table. is even. The seats are numbered clockwise from 1 to . The person in seat wears a hat with the number on it. Each person looks at the person sitting directly across from them in the circle. Determine how many people see someone wearing a hat with the same number as their own.
Input
The first line contains one even positive integer , the number of people at the gathering. Each of the next lines contains one non-negative integer , the hat number of person .
Output
Print a single integer: the number of people who see the same hat number as their own on the person directly across from them.