#include <bits/stdc++.h>
using namespace std;
long long over2(int n) {
  if (n <= 1) return 0;
  return (long long)(n * (n - 1)) / 2;
}
int main(int argc, const char *argv[]) {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<list<int> > neigh;
  neigh.resize(n);
  vector<int> degs;
  degs.resize(n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    neigh[a - 1].push_back(b - 1);
    neigh[b - 1].push_back(a - 1);
    degs[a - 1]++;
    degs[b - 1]++;
  }
  long long sum = 0;
  for (int i = 0; i < n; ++i) sum += over2(degs[i]);
  cout << sum << endl;
  return 0;
}
