#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 121;
int a[N], b[N], last[N], kol, ans, v, u, i, n;
inline void add(int v, int u) {
  a[++kol] = u;
  b[kol] = last[v];
  last[v] = kol;
}
void dfs(int v, int p, int len) {
  if (len == 2) {
    ++ans;
    return;
  }
  int x = last[v];
  while (x) {
    if (a[x] != p) dfs(a[x], v, len + 1);
    x = b[x];
  }
}
int main() {
  cin >> n;
  for (i = 1; i < n; ++i) {
    cin >> v >> u;
    add(v, u);
    add(u, v);
  }
  for (i = 1; i <= n; ++i) dfs(i, 0, 0);
  cout << ans / 2 << endl;
}
