#include <bits/stdc++.h>
using namespace std;
int n, s, k, m, x, y, p;
char used[100001];
int gl[100001];
vector<vector<int> > a;
vector<int> b[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin.tie(0);
  cin >> n;
  m = n - 1;
  a.resize(n + 1);
  for (int i = 1; i <= m; ++i) {
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  k = 0;
  for (int i = 1; i <= n; ++i) {
    int sz = (int)a[i].size();
    if (sz > 1) s += sz * (sz - 1) / 2;
  }
  cout << s;
}
