n = int(input())

edges = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append(v)
    edges[v].append(u)

route = []
stack = []
visited = [False] * n
stack.append(0)
while stack:
    u = stack.pop()
    visited[u] = True
    route.append(u)
    for v in edges[u]:
        if not visited[v]:
            stack.append(v)

one = [0] * n
two = [0] * n
three = [0] * n
ans = 0
for pos in route[::-1]:
    visited[pos] = False
    for npos in edges[pos]:
        if visited[npos]:
            continue

        ans += 1
        ans += one[npos]
        ans += one[pos] * 1
        ans += two[npos]
        ans += one[pos] * one[npos]
        ans += two[pos]

        one[pos] += 1
        two[pos] += one[npos]
        three[pos] += two[npos]


print(ans)