#include #include #include using namespace std; using namespace atcoder; using mint = modint1000000007; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 long long ans = 0LL; int n; vector sz; vector> E; void dfs(int cur,int p){ sz[cur] = 1; ans += n; rep(i,E[cur].size()){ int to = E[cur][i]; if(to==p)continue; dfs(to,cur); ans += sz[to] * (n-sz[to]); sz[cur] += sz[to]; } ans += (n-sz[cur]) * sz[cur]; } int main(){ cin>>n; E.resize(n); rep(i,n-1){ int u,v; scanf("%d %d",&u,&v); u--;v--; E[u].push_back(v); E[v].push_back(u); } sz.resize(n,0); dfs(0,-1); cout<