#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> adj[10004];
void dfs(int node, int parent, int len) {
  if (len == 2) {
    k++;
    return;
  }
  for (auto child : adj[node]) {
    if (child != parent) dfs(child, node, len + 1);
  }
}
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    k = 0;
    dfs(i, 0, 0);
    ans += k;
  }
  printf("%I64d\n", ans / 2);
  return 0;
}
