#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> adj[100 * 1000 + 5];
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int az = adj[i].size();
    if (az >= 2) ans += az * (az - 1) / 2;
  }
  cout << ans;
}
