#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
vector<int> gr[N];
int ans = 0;
void dfs(int v, int p = -1) {
  for (int to : gr[v])
    if (to != p) {
      dfs(to, v);
      ans += (gr[to].size() - 1);
    }
  ans += ((gr[v].size() - (v != 1)) * (gr[v].size() - 1 - (v != 1))) / 2;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  dfs(1);
  cout << ans;
  return 0;
}
