#include <bits/stdc++.h>
using namespace std;
queue<int> Q;
vector<int> edges[11000];
int num[11000];
int ans;
int n;
int bfs(int s) {
  int cnt = 0;
  for (int i = 0; i < edges[s].size(); i++) {
    cnt += edges[edges[s][i]].size() - 1;
  }
  return cnt;
}
int main(void) {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  for (i = 1; i <= n; i++) {
    num[i] = bfs(i);
    ans += num[i];
  }
  printf("%d", ans / 2);
  return 0;
}
