#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, k, w, ans;
int LINK[20005], l[10005], ed[20005];
void bd(int x, int y) {
  LINK[w] = l[x];
  l[x] = w;
  ed[w] = y;
  w++;
}
void DFS(int x, int y) {
  int k = 0;
  for (int i = l[x]; i != -1; i = LINK[i]) {
    if (ed[i] == y) continue;
    DFS(ed[i], x);
    k++;
  }
  ans += k * (k - 1) / 2;
  if (y != 0) ans += k;
}
int main() {
  memset(l, -1, sizeof(l));
  scanf("%d", &n);
  for (int i = (0); i < (n - 1); i++) {
    scanf("%d %d", &x, &y);
    bd(x, y);
    bd(y, x);
  }
  DFS(1, 0);
  printf("%d\n", ans);
  return 0;
}
