#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
const long long mod = 1e9 + 7;
int son[N], ret, head[N], tot, n;
struct Edge {
  int v, next;
} edge[N << 1];
void add(int u, int v) {
  edge[tot].v = v;
  edge[tot].next = head[u];
  head[u] = tot++;
}
void dfs(int u, int f) {
  for (int i = head[u]; ~i; i = edge[i].next) {
    int v = edge[i].v;
    if (v == f) continue;
    dfs(v, u);
    ;
    ++son[u];
    ret += son[v];
  }
  ret += son[u] * (son[u] - 1) / 2;
}
int main() {
  scanf("%d", &n);
  memset(head, -1, sizeof(head));
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dfs(1, 0);
  printf("%d\n", ret);
  return 0;
}
