#include <bits/stdc++.h>
using namespace std;
const int MAX = 10005;
vector<int> tree[MAX];
int main() {
  ios_base ::sync_with_stdio(false);
  int n;
  cin >> n;
  int x, y;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    tree[x].push_back(y);
    tree[y].push_back(x);
  }
  int cS = 0;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    cS = tree[i].size();
    sum += (cS * (cS - 1)) / 2;
  }
  cout << sum << "\n";
}
