#include <bits/stdc++.h>
using namespace std;
vector<int> vertices[10001];
int find2P(int start) {
  int next;
  int count = 0;
  for (int i = 0; i < vertices[start].size(); i++) {
    next = vertices[start][i];
    count += vertices[next].size() - 1;
  }
  return count;
}
int main() {
  int n, x, y;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    vertices[x].push_back(y);
    vertices[y].push_back(x);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += find2P(i);
  }
  cout << ans / 2 << endl;
}
