#include <bits/stdc++.h>
using namespace std;
int ans;
vector<int> adj[11111];
void DFS(int x, int par, int dol) {
  if (dol > 2) return;
  if (dol == 2) ans++;
  for (int v : adj[x]) {
    if (v == par) continue;
    DFS(v, x, dol + 1);
  }
}
int main() {
  ans = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) DFS(i, -1, 0);
  printf("%d", ans / 2);
}
