Hotels

No attempts yetTime limit3sMemory limit256 MB

Problem

Byteotia has nn towns connected by n1n-1 roads of equal length. The roads form a tree.

The king wants three luxury hotels in three different towns, all at the same pairwise distance. Count how many such triplets exist.

Input

The first line contains nn (1n50001 \le n \le 5000). Each of the next n1n-1 lines contains two integers aa and bb (1abn1 \le a \le b \le n), the endpoints of a road.

Output

Print the number of valid hotel triplets.