50 Points

Triangles

Given an input of lines, find the amount of loops which traverse three and only three paths to return back to the starting node. There is to be a maximum of one edge between a unique pair of nodes. They are bi-directional.

When drawn, this would represent a triangle.

Example Input

# Formatted as: Node <name>
Node a
Node b
Node c
Node d

# Formatted as: Edge <from> <to> <distance>
Edge a b 10
Edge b c 20
Edge c a 5
Edge a d 20

Example Output

1