#include <bits/stdc++.h>
using namespace std;
#define maxn 5005
int n,i,j,x,y,z,rr;
vector<int> bl,v[maxn],g[maxn];
long long ans;
void dfs(int x,int pred,int dep,int fr,int sub){
v[dep].push_back(sub);
for(int i=0;i<(int)g[x].size();i++){
if(g[x][i]==fr||g[x][i]==pred)continue;
dfs(g[x][i],x,dep+1,fr,sub);
}
}
long long calc(vector<int> a){
int n=(int)a.size();
long long tot=0,pairs=0,sum=0;
for(int i=0;i<n;i++){
tot+=pairs*a[i];
pairs+=sum*a[i];
sum+=a[i];
}
return tot;
}
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
scanf("%d",&n);
for(int i=1;i<n;i++){
scanf("%d%d",&x,&y);
g[x].push_back(y);
g[y].push_back(x);
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++)v[j].clear();
for(int j=0;j<(int)g[i].size();j++)dfs(g[i][j],-1,1,i,j);
for(int j=1;j<=n;j++)if(!v[j].empty()){
sort(v[j].begin(),v[j].end());
z=0;
bl.clear();
while(z<v[j].size()){
rr=z;
for(int q=z+1;q<(int)v[j].size();q++)
if(v[j][q]==v[j][z])rr++;else break;
bl.push_back(rr-z+1);
z=rr+1;
}
ans+=calc(bl);
}
}
printf("%lld\n",ans);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBtYXhuIDUwMDUKCmludCBuLGksaix4LHkseixycjsKdmVjdG9yPGludD4gYmwsdlttYXhuXSxnW21heG5dOwpsb25nIGxvbmcgYW5zOwoKdm9pZCBkZnMoaW50IHgsaW50IHByZWQsaW50IGRlcCxpbnQgZnIsaW50IHN1Yil7CiAgICB2W2RlcF0ucHVzaF9iYWNrKHN1Yik7CiAgICBmb3IoaW50IGk9MDtpPChpbnQpZ1t4XS5zaXplKCk7aSsrKXsKICAgICAgICBpZihnW3hdW2ldPT1mcnx8Z1t4XVtpXT09cHJlZCljb250aW51ZTsKICAgICAgICBkZnMoZ1t4XVtpXSx4LGRlcCsxLGZyLHN1Yik7CiAgICB9Cn0KCmxvbmcgbG9uZyBjYWxjKHZlY3RvcjxpbnQ+IGEpewogICAgaW50IG49KGludClhLnNpemUoKTsKICAgIGxvbmcgbG9uZyB0b3Q9MCxwYWlycz0wLHN1bT0wOwogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgdG90Kz1wYWlycyphW2ldOwogICAgICAgIHBhaXJzKz1zdW0qYVtpXTsKICAgICAgICBzdW0rPWFbaV07CiAgICB9CiAgICByZXR1cm4gdG90Owp9CgppbnQgbWFpbigpewogICAgLy9mcmVvcGVuKCJpbnB1dC50eHQiLCJyIixzdGRpbik7CiAgICAvL2ZyZW9wZW4oIm91dHB1dC50eHQiLCJ3IixzdGRvdXQpOwogICAgc2NhbmYoIiVkIiwmbik7CiAgICBmb3IoaW50IGk9MTtpPG47aSsrKXsKICAgICAgICBzY2FuZigiJWQlZCIsJngsJnkpOwogICAgICAgIGdbeF0ucHVzaF9iYWNrKHkpOwogICAgICAgIGdbeV0ucHVzaF9iYWNrKHgpOwogICAgfQogICAgZm9yKGludCBpPTE7aTw9bjtpKyspewogICAgICAgIGZvcihpbnQgaj0xO2o8PW47aisrKXZbal0uY2xlYXIoKTsKICAgICAgICBmb3IoaW50IGo9MDtqPChpbnQpZ1tpXS5zaXplKCk7aisrKWRmcyhnW2ldW2pdLC0xLDEsaSxqKTsKICAgICAgICBmb3IoaW50IGo9MTtqPD1uO2orKylpZighdltqXS5lbXB0eSgpKXsKICAgICAgICAgICAgc29ydCh2W2pdLmJlZ2luKCksdltqXS5lbmQoKSk7CiAgICAgICAgICAgIHo9MDsKICAgICAgICAgICAgYmwuY2xlYXIoKTsKICAgICAgICAgICAgd2hpbGUoejx2W2pdLnNpemUoKSl7CiAgICAgICAgICAgICAgICBycj16OwogICAgICAgICAgICAgICAgZm9yKGludCBxPXorMTtxPChpbnQpdltqXS5zaXplKCk7cSsrKQogICAgICAgICAgICAgICAgICAgIGlmKHZbal1bcV09PXZbal1bel0pcnIrKztlbHNlIGJyZWFrOwogICAgICAgICAgICAgICAgYmwucHVzaF9iYWNrKHJyLXorMSk7CiAgICAgICAgICAgICAgICB6PXJyKzE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYW5zKz1jYWxjKGJsKTsKICAgICAgICB9CiAgICB9CiAgICBwcmludGYoIiVsbGRcbiIsYW5zKTsKCiAgICByZXR1cm4gMDsKfQ==