P12417 [AOJ] Similarity of Subtrees
普及
题目描述

Example

Input

5
1 2
1 3
1 4
1 5

Output

6

输入格式

见题面

输出格式

见题面

样例输入
5 1 2 1 3 1 4 1 5
样例输出
6