#include <bits/stdc++.h>
using namespace std;
const int max_n = 10010;
vector<int> G[max_n];
int n, ans = 0;
void dfs(int v, int par, int dis) {
  if (dis == 2) {
    ans++;
    return;
  }
  for (int u : G[v]) {
    if (u != par) {
      dfs(u, v, dis + 1);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    dfs(i, i, 0);
  }
  cout << ans / 2;
  return 0;
}
