#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int>> g;
int main() {
  int m, n;
  cin >> n;
  m = n - 1;
  g = vector<vector<int>>(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long s = g[i].size();
    ans += ((s * (s - 1)) / 2);
  }
  cout << ans;
  return 0;
}
