Under construction

Still being built. Things may change

Hat Circle

Interview

Time limit1sMemory limit1024 MB

Summary
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, NN people sit around a circular table. NN is even. The seats are numbered clockwise from 1 to NN. The person in seat ii wears a hat with the number HiH_i 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 NN, the number of people at the gathering. Each of the next NN lines contains one non-negative integer HiH_i, the hat number of person ii.

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.

Examples2

  1. Example 1

    Input
    4
    0
    1
    0
    1
    
    Expected output
    4
    
  2. Example 2

    Input
    4
    1
    0
    0
    1
    
    Expected output
    0