#include <bits/stdc++.h>
using namespace std;
vector<int> v[10009];
int n;
bool vis[10009];
int main() {
  cin >> n;
  int h = n;
  n--;
  while (n--) {
    int a, b;
    scanf("%d%d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int res = 0;
  for (int i = 1; i <= h; i++) {
    res += (v[i].size() * (v[i].size() - 1)) / 2;
  }
  cout << res << endl;
  return 0;
}
