#include <bits/stdc++.h>
using namespace std;
const int M = 10005;
vector<int> g[M];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < g[i].size(); j++) {
      int v = g[i][j];
      ans += ((int)g[v].size()) - 1;
    }
  }
  cout << ans / 2;
  return 0;
}
