#define rep(i, n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include using namespace std; vector G[200200]; int dp[200200][4]; ll ans=0; void dfs(int v,int p){ dp[v][0]=1; ll c1=0,c2=0; for(auto nv:G[v]){ if(nv==p) continue; dfs(nv,v); rep(i,3) dp[v][i+1]+=dp[nv][i]; c1+=dp[nv][0]; c2+=dp[nv][1]; } ans+=c1*(c1-1)/2+(c1-1)*c2; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; rep(i,n-1){ int u,v; cin>>u>>v; u--,v--; G[u].push_back(v); G[v].push_back(u); } dfs(0,-1); rep(i,n) for(int j=1;j<=3;j++) ans+=dp[i][j]; cout<