// Original C++ solution (slower):
//

/*

ID: kfoozmi1

LANG: C++

TASK:

*/

#include <bits/stdc++.h>

using namespace std;



#ifdef kfoozminus

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)



void faltu() {

	cerr << endl;

}



template <typename T>

void faltu(T a[], int n) {

	for(int i = 0; i < n; ++i) cerr << a[i] << ' ';

	cerr << endl;

}



template <typename First, typename ... hello>

void faltu(First arg, const hello&... rest) {

	cerr << arg << ' ';

	faltu(rest...);

}

#else

#define dbg(args...)

#endif



#define PB push_back

#define F first

#define S second

#define MP make_pair

#define SQR(a) ((a) * (a))

#define vsort(v) sort(v.begin(), v.end())

#define memset(a, b) memset(a, b, sizeof a)

#define PQ priority_queue

#define PI acos(-1)

#define EPS 1e-9



#define B1 43

#define B2 43



#define MOD1 1000000007

#define MOD2 1000000009



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



//int dx[] = {0, 0, +1, -1};

//int dy[] = {+1, -1, 0, 0};

//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};

//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};



inline bool checkBit(ll n, int i) { return n & (1LL << i); }

inline ll setBit(ll n, int i) { return n | (1LL << i); }

inline ll resetBit(ll n, int i) { return n & (~ (1LL << i)); }

inline bool EQ(double a, double b) { return fabs(a-b) < EPS; }

inline double dist(double ix, double iy, double jx, double jy) { return sqrt(SQR(ix - jx) + SQR(iy - jy)); }



#define PMX 1000000



int marked[PMX/64+2];



#define mark(x) marked[x>>6] |= (1<<((x&63)>>1))

#define check(x) (marked[x>>6] & (1<<((x&63)>>1)))



bool isPrime(int x)

{

    return (x>1) && ((x==2) || ((x&1) && (!(check(x)))));

}



void seive(int n)

{

    int i, j;

    for(i=3; i*i<=n; i+=2)

    {

        if(!check(i))

        {

            for(j=i*i; j<=n; j+=i<<1)

            {

                mark(j);

            }

        }

    }

}



ll bigMod(ll a, ll b, ll MOD)

{

	ll r = 1;

	while(b) {

		if(b & 1) (r *= a) %= MOD;

		b >>= 1;

		(a *= a) %= MOD;

	}

	return r;

}



ll add(ll a, ll b, ll MOD)

{

	ll ret = a + b;

	if(ret >= MOD) ret -= MOD;

	return ret;

}



ll sub(ll a, ll b, ll MOD)

{

	ll ret = a - b;

	if(ret < 0) ret += MOD;

	return ret;

}



ll mul(ll a, ll b, ll MOD)

{

	ll ret = a * b;

	if(ret >= MOD) ret %= MOD;

	return ret;

}



#define INF 100000000

#define MX 100007



map< pll, ll > mp;

ll ans;

vector<int> edge[MX];



pll dfs(int nd)

{

	dbg(nd);

	pll h = {0, 0};

	for(int k = 0; k < edge[nd].size(); k ++) {



		pll p = dfs(edge[nd][k]);

		h.F = add(h.F, p.F, MOD1);

		h.S = add(h.S, p.S, MOD2);

	}

	h.F = add(mul(h.F, B1, MOD1), 1, MOD1);

	h.S = add(mul(h.S, B2, MOD2), 1, MOD1);

	ans += mp[h];

	mp[h] ++;

	return h;

}



int main()

{

#ifdef kfoozminus

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

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

#endif

	int n, i, u, v;



	scanf("%d", &n);

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



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

		edge[u].PB(v);

	}

	dfs(1);

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

        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: