#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(ll i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=1000000007; constexpr ll INF=2e18; VVI edge(110000,VI(0)); ll ans=0; ll n; int dfs(int v, int p){ int cnt=1; for(auto to:edge[v]){ if(to!=p){ int e=dfs(to,v); cnt+=e; ans+=e*(n-e)*2; } } return cnt; } int main(){ cin >> n; int a, b; REP(i,n-1){ cin >> a >> b; a--, b--; edge[a].push_back(b); edge[b].push_back(a); } dfs(0,-1); cout << ans+n*n << endl; }