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