There is a tree of N vertices numbered 1 to N. A path is a sequence of distinct vertices (v_1,…,v_k) such that k≥1, v_iv_i+1 is an edge for all 1≤i≤k−1, and v_1≤v_k.
Count the number of paths such that the vertices v_1,…,v_k form a contiguous range, or more formally, the set v_1,…,v_k=a,a+1,…,b for some integers a≤b.
The first line contains an integer N (1≤N≤50,000). The next N−1 lines contain the edges of the tree. The i-th of these lines contains two space-separated integers u_i and v_i (1≤u_i,v_i≤N) denoting that u_iv_i is an edge. It is guaranteed that the given graph is a tree.
On a single line output the desired number of paths.
The paths are (1), (2), (3), (1,2), and (2,1,3).