#include <bits/stdc++.h>
using namespace std;
int bfs(vector<vector<int> > vv) {
  int n = vv.size();
  int res = 0;
  bool c[n];
  int p[n];
  for (int i = 0; i < n; i++) {
    c[i] = false;
    p[i] = -1;
  }
  queue<int> q;
  c[0] = true;
  q.push(0);
  int x, y, d;
  while (!q.empty()) {
    x = q.front();
    q.pop();
    d = vv[x].size();
    res += x == 0 ? (d * (d - 1)) / 2 : ((d - 1) * (d - 2)) / 2;
    for (int j = 0; j < d; j++) {
      y = vv[x][j];
      if (!c[y]) {
        c[y] = true;
        p[y] = x;
        if (p[x] != -1) {
          res++;
        }
        q.push(y);
      }
    }
  }
  return res;
}
int main() {
  int n, a, b;
  cin >> n;
  vector<vector<int> > vv(n);
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    vv[a - 1].push_back(b - 1);
    vv[b - 1].push_back(a - 1);
  }
  cout << bfs(vv) << endl;
  return 0;
}
