#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20;
vector<int> v[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int s = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      s += v[v[i][j]].size() - 1;
    }
  }
  cout << s / 2;
}
