#include #include using ll = long long; using ull = unsigned long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++) using namespace std; using namespace atcoder; using mint = modint998244353; const int inf = 1000000007; const ll longinf = 1ll << 60; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vector> g(n); rep(i, n - 1) { int x, y; cin >> x >> y; --x; --y; g[x].push_back(y); g[y].push_back(x); } ll ans = 0; auto dfs = [&](auto &&self, int x, int p) -> tuple { int v0 = 1, v1 = 0, v2 = 0; for(auto to : g[x]) { if(to == p) continue; auto [d1, d2, d3] = self(self, to, x); ans += (ll)v0 * d1; ans += (ll)v0 * d2; ans += (ll)v0 * d3; ans += (ll)v1 * d1; ans += (ll)v1 * d2; ans += (ll)v2 * d1; v1 += d1; v2 += d2; } return {v0, v1, v2}; }; dfs(dfs, 0, -1); cout << ans << endl; return 0; }