#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int d[1 << 20];
int main(void) {
  srand(time(0));
  cout << fixed << setprecision(7);
  cerr << fixed << setprecision(7);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    ++d[a];
    ++d[b];
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += d[i] * (d[i] - 1) / 2;
  cout << ans << '\n';
  return 0;
}
