n = int(input()) E = [] C = [0 for _ in range(n)] for _ in range(n - 1): u, v = map(int, input().split()) u -= 1 v -= 1 C[u] += 1 C[v] += 1 E.append((u, v)) ans = n - 1 for i in range(n): ans += C[i] * (C[i] - 1) // 2 for i in range(n - 1): u, v = E[i] ans += (C[u] - 1) * (C[v] - 1) print(ans)