#include using namespace std; int main() { int N; cin >> N; vector u(N-1, 0), v(N-1, 0); for(int i = 0; i < N-1; i++) { cin >> u[i] >> v[i]; u[i]--, v[i]--; } vector G(N, vector(0, 0)); for(int i = 0; i < N-1; i++) { G[u[i]].push_back(v[i]), G[v[i]].push_back(u[i]); } vector G0(N, 0LL), G1(N, 0LL), G2(N, 0LL), G3(N, 0LL); vector P(N, 0); auto dfs = [&](auto f, int v, int p) -> void { G0[v]++; P[v] = p; for(int nv : G[v]) { if(nv == p) continue; f(f, nv, v); G1[v] += G0[nv]; G2[v] += G1[nv]; G3[v] += G2[nv]; } }; dfs(dfs, 0, -1); long long ans(0); for(int i = 0; i < N; i++) { ans += G3[i]; ans += G2[i]; int j(P[i]); if(j == -1) { ans += G1[i]; ans += G0[i]; continue; } ans += G2[j]; ans += G1[j]; int k(P[j]); if(k == -1) { ans += G0[j]; continue; } ans += G1[k]; ans += G0[k]; int l(P[k]); if(l == -1) continue; ans += G0[l]; } ans = (ans-(long long)N) / 2; cout << ans << endl; return 0; }