Heidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies.

On the surface, the Tree of Life is just a regular undirected tree well-known from computer science. This means that it is a collection of n points (called vertices), some of which are connected using n - 1 line segments (edges) so that each pair of vertices is connected by a path (a sequence of one or more edges).

To decipher the prophecy, Heidi needs to perform a number of steps. The first is counting the number of lifelines in the tree – these are paths of length 2, i.e., consisting of two edges. Help her!

Input

The first line of the input contains a single integer n – the number of vertices in the tree (1 ≤ n ≤ 10000). The vertices are labeled with the numbers from 1 to n. Then n - 1 lines follow, each describing one edge using two space-separated numbers a b – the labels of the vertices connected by the edge (1 ≤ a < b ≤ n). It is guaranteed that the input represents a tree.

Output

Print one integer – the number of lifelines in the tree.

Examples

Input

4
1 2
1 3
1 4


Output

3

Input

5
1 2
2 3
3 4
3 5


Output

4

Note

In the second sample, there are four lifelines: paths between vertices 1 and 3, 2 and 4, 2 and 5, and 4 and 5.
#from random import randrange
#import time
 
#class Profiler(object):
    #def __enter__(self):
    #    self._startTime = time.time()
         
    #def __exit__(self, type, value, traceback):
     #   print ("Elapsed time: {:.10f} sec".format(time.time() -self._startTime))

#masa = [randrange(1, 10000) for i in range(10000)]
#masb = [randrange(1, 10000) for i in range(10000)]

  
def UpperBound(A, key): 
    left = -1 
    right = len(A) 
    while right > left + 1: 
        middle = (left + right) // 2 
        if A[middle] > key: 
            right = middle 
        else: 
            left = middle
 
    return right
n=int(input())
masa=[]
masb=[]
mas=[]
for i in range(n-1):
   mas.append(input().split())
s=0 
#with Profiler() as p:
   # mas= [(100, 67), (1, 2), (4, 5)]
for i in range(n-1):
    masa.append(int(mas[i][0]))
    masb.append(int(mas[i][1]))
#with Profiler() as p:
   #masa=sorted(masa, key=lambda x: x[:-1])
masa.sort()
masb.sort()
#with Profiler() as p:
  #for i in range(1000):
   # masb[i]
   #masa=[1,1,1]
   #masb=[3,4,2]
   
    #print(UpperBound(ma, 2))  #return 4
for i in range(len(masb)):
      foun=UpperBound(masa,masb[i])
      xx=masa[i:foun].count(masb[i])
      s=s+xx
      #print(xx)
   #print(s)
for i in range(len(masa)):   
      foun=UpperBound(masa,masa[i])
      xx=masa[i+1:foun].count(masa[i])
      s=s+xx
      #print(xx)
for i in range(len(masa)): 
      foun=UpperBound(masb,masa[i]) 
      xx=masb[i+1:foun].count(masa[i])   
      s=s+xx
for i in range(len(masb)):   
      foun=UpperBound(masb,masb[i])
      xx=masb[i+1:foun].count(masb[i])
      s=s+xx

print(s)