#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> V[n + 1];
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    V[a].push_back(b);
    V[b].push_back(a);
  }
  long long int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int d = V[i].size();
    if (d >= 2) cnt += (d * (d - 1)) / 2;
  }
  cout << cnt << '\n';
  return 0;
}
