Example

Input

5
1 2
1 3
1 4
1 5


Output

6
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;

const ULL HS=19260817;
const int maxn=1e5;

ULL ans=0;
int du[maxn+10];
vector<int>G[maxn+10];
unordered_map<ULL,ULL>S;

ULL gao(int x){
	ULL t=0;
	for(int i=0;i<du[x];i++)t+=gao(G[x][i]);
	t=t*HS+1;
	ans+=S[t]++;
	return t;
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		G[a].push_back(b);
		du[a]++;
	}
	gao(1);
	//printf("%llu\n",ans);
	cout<<ans<<endl;
	return 0;
}