#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
vector<int> g[N];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    if (g[i].size() >= 2) {
      int tmp = g[i].size();
      sum += tmp * (tmp - 1) / 2;
    }
  }
  cout << sum;
}
