#include <bits/stdc++.h>
using namespace std;
vector<int> adj[10000 + 5];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int u = adj[i].size();
    ans += (u * (u - 1)) / 2;
  }
  cout << ans;
  return 0;
}
