#include <bits/stdc++.h>
using namespace std;
vector<int> arr[100005];
int vis[100005];
int dfs(int start) {
  int i, j, k, ans = 0;
  vis[start] = 1;
  k = arr[start].size() - 1;
  for (i = 0; i < arr[start].size(); i++) {
    if (vis[arr[start][i]]) continue;
    ans += k + dfs(arr[start][i]);
    k--;
  }
  return ans;
}
int main() {
  int i, j, k, n, m, p, x, y;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    arr[x].push_back(y);
    arr[y].push_back(x);
  }
  printf("%d\n", dfs(1));
  return 0;
}
