Example

Input

5
1 2
1 3
1 4
1 5


Output

6
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef unsigned long long ull;
int b=67280421310721,n,a,c;
ull ans;
map<ull,ull>m;
vector<int>v[100009];
ull dfs(int x){
  ull res=1;
  r(i,v[x].size()) res+=dfs(v[x][i]);
  res*=b;
  ans+=m[res]++;
  return res;
}
signed main(){b=21387612863821;
  cin>>n;
  r(i,n-1){
    cin>>a>>c;
    v[a].push_back(c);
  }
  dfs(1);
  cout<<ans<<endl;
}
