#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(int i=0;i G[200010]; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j; ll N; cin >> N; for(i=1;i> a >> b; G[a].push_back(b); G[b].push_back(a); } ll ans=N-1; for(i=1;i<=N;i++){ ll n=G[i].size(); if(n==0) continue; ans+=n*(n-1)/2; for(j=0;jG[i][j]) continue; ll k=G[i][j]; ll m=G[k].size(); ans+=(n-1)*(m-1); } } cout << ans << endl; return 0; }