#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, m;
vector<int> ady[10005];
int mark[10005];
queue<int> cola;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int sum = 0;
  int a, b;
  for (int i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    ady[a].push_back(b);
    ady[b].push_back(a);
  }
  mark[1] = 1;
  cola.push(1);
  int len;
  while (!cola.empty()) {
    int curr = cola.front();
    cola.pop();
    len = ady[curr].size();
    for (int i = 0; i < len; ++i) {
      if (!mark[ady[curr][i]]) {
        mark[ady[curr][i]] = mark[curr] + 1;
        cola.push(ady[curr][i]);
      }
    }
    if (mark[curr] > 2) ++sum;
  }
  len = ady[1].size();
  sum += max(0, (len * (len - 1)) / 2);
  for (int i = 2; i <= n; ++i) {
    len = ady[i].size() - 1;
    sum += max(0, (len * (len - 1)) / 2);
  }
  cout << sum << '\n';
  return 0;
}
