SP9788 FACEFRND - Friends of Friends

Description

Bob uses a social networking site almost all the time. He was wondering what are Friends of Friends in that social networking site? If “X” is his friend, and “Y” is X’s friend but “Y” is not his friend, then “Y” is called his friend of friend. You have to find how many friends of friends Bob has. (Each user in that social networking site has a unique 4-digit ID number)

Input Format

First line contains a integer “N” (1

Output Format

Output a single integer denoting Bob's number of friends of friends. **Example** ``` Input: 3 2334 5 1256 4323 7687 3244 5678 1256 2 2334 7687 4323 5 2334 5678 6547 9766 9543 Output: 6 ```