// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;



#define pb              push_back

#define PII             pair <int,int>

#define PLL             pair <ll,ll>

#define mp              make_pair

#define xx              first

#define yy              second

#define all(v)          v.begin(),v.end()



#define lt              2*n

#define rt              2*n+1

#define clft            2*n,st,mid

#define crgt            2*n+1,mid+1,ed



#define CLR(a)          memset(a,0,sizeof(a))

#define SET(a)          memset(a,-1,sizeof(a))



#define eps             1e-9

#define PI              acos(-1.0)

#define MAX             100010

#define INF             2000000000



/******************************************************************************************/



#define mod1            1000000007

#define mod2            1000000123

#define base            100001



vector <ll> ed[MAX];

ll has1[MAX],has2[MAX];

map <PLL,ll> M;



void dfs(ll u,ll p)

{

    ll i,v,h1 = 0,h2 = 0;

    for(i=0;i<ed[u].size();i++){

        v = ed[u][i];

        if(v==p) continue;

        dfs(v,u);

        h1 += has1[v];

        h2 += has2[v];

        h1 %= mod1;

        h2 %= mod2;

    }

    has1[u] = (h1*base + 1)%mod1;

    has2[u] = (h2*base + 1)%mod2;

    M[mp(h1,h2)]++;

}



int main()

{

    //ios_base::sync_with_stdio(false);

    //freopen("in.txt","r",stdin);

    //freopen("out.txt","w",stdout);



    ll n,i,u,v;

    cin >> n;

    for(i=1;i<n;i++){

        cin >> u >> v;

        ed[u].pb(v);

        ed[v].pb(u);

    }

    dfs(1,0);



    ll ans = 0;

    map <PLL,ll> :: iterator it = M.begin();

    while(it!=M.end()){

        ans += (it->second*(it->second-1))/2;

        it++;

    }

    cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cstring>

#include<vector>

#include<queue>

#include<stack>

#include<cmath>

#include<set>

#include<map>

using namespace std;

#define rep(i,a,n) for (int i=a;i<n;i++)

#define per(i,a,n) for (int i=n-1;i>=a;i--)

#define pb push_back

#define fi first

#define se second

#define dbg(...) cerr<<"["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"<<endl;

typedef vector<int> VI;

typedef long long ll;

typedef pair<double,int> PII;

const ll p=998244353;

const ll mod=1e9+7;

const int maxn=1e5+100;

map<ll,int> mp;



struct node

{

    int to,next;

}e[maxn*2];



int tol=0;

int head[maxn];

void add(int u,int v)

{

    e[++tol].to=v,e[tol].next=head[u],head[u]=tol;

}

ll dfs(int u,int f)

{

    ll ans=1;

    for(int i=head[u];i;i=e[i].next)

    {

        int v=e[i].to;

        if(v==f) continue;

        ans=(ans+dfs(v,u)*mod%p)%p;

    }

    mp[ans]++;

    return ans;

}





int main()

{

    int n;

    scanf("%d",&n);

    rep(i,1,n)

    {

        int u,v;

        scanf("%d%d",&u,&v);

        add(u,v),add(v,u);

    }

    mp.clear();

    dfs(1,0);

    ll ans=0;

    map<ll,int>::iterator it;

    for(it=mp.begin();it!=mp.end();it++) ans+=1ll*(it->se)*(it->se-1)/2;

    printf("%lld\n",ans);

    return 0;

}

// Fastest known solution for this problem: