//all checkup with acceleration #include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main(){ ll N; cin >> N; vector> g(N); rep(i,N-1){ ll s,t; cin >> s >> t; s--; t--; g[s].push_back(t); g[t].push_back(s); } queue> q; rep(i,N){ q.push(make_pair(i,0)); } ll ans=0; rep(i,N){ vector seen(N); queue> q; q.push(make_pair(i,0)); seen[i]=1; while(!q.empty()){ ll c=q.front().first; ll v=q.front().second; q.pop(); //cout << i << " " << c << endl; if(v!=0)ans++; if(v!=2){ for (const auto& e : g[c]) { if (seen[e]==0){ q.push(make_pair(e,v+1)); seen[e]=1; } } }else{ for (const auto& e : g[c]) { if (seen[e]==0){ ans++; seen[e]=1; } } } } } cout << ans/2 << endl; }