#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<pair<int, int> > > edges(n + 1);
  vector<bool> edgeisinserted(n - 1, 0);
  vector<int> Directnodes(n + 1, 0);
  int a = 0, b = 0;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &a, &b);
    edges[a].push_back(pair<int, int>(b, i));
    edges[b].push_back(pair<int, int>(a, i));
  }
  queue<int> q;
  q.push(a);
  int ans = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < edges[u].size(); i++) {
      int v = edges[u][i].first;
      int index = edges[u][i].second;
      if (!edgeisinserted[index]) {
        edgeisinserted[index] = 1;
        ans += Directnodes[u];
        Directnodes[u]++;
        Directnodes[v]++;
        q.push(v);
      }
    }
  }
  cout << ans;
  return 0;
}
