#include <bits/stdc++.h>
using namespace std;
vector<set<int> > arr;
long long res = 0;
void dfs(int vertex, int prev, int level) {
  for (int v : arr[vertex]) {
    if (v == prev) {
      continue;
    }
    if (level == 2) {
      res++;
      continue;
    } else {
      dfs(v, vertex, level + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  arr = vector<set<int> >(n + 1);
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    arr[a].insert(b);
    arr[b].insert(a);
  }
  for (int i = 1; i <= n; ++i) {
    dfs(i, -1, 1);
  }
  cout << res / 2 << endl;
  return 0;
}
