#include <bits/stdc++.h>
using namespace std;
long long int degree[100001];
int main() {
  memset(degree, 0, sizeof(degree));
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    degree[x] += 1;
    degree[y] += 1;
  }
  long long int ans = 0;
  for (int i = 1; i <= n; ++i) ans += degree[i] * (degree[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
