#include <bits/stdc++.h>
using namespace std;
void read(int a = 0) {
  freopen("in", "r", stdin);
  if (a) freopen("out", "w", stdout);
}
long long a[100009] = {};
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    a[--x]++, a[--y]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) ans += a[i] * (a[i] - 1) / 2;
  cout << ans;
}
