#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 100;
vector<int> G[maxn];
int n;
int sum[maxn];
int res;
void dfs(int u, int fa) {
  sum[u] = 0;
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (v != fa) {
      dfs(v, u);
      sum[u]++;
      res += sum[v];
    }
  }
  res += (sum[u] - 1) * sum[u] / 2;
}
int main() {
  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);
  }
  res = 0;
  dfs(1, -1);
  printf("%d\n", res);
  return 0;
}
