#include <bits/stdc++.h>
using namespace std;
long long degree[100000 + 100];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  memset(degree, 0, sizeof(degree));
  for (int i = 1; i <= n - 1; ++i) {
    int st, en;
    cin >> st >> en;
    ++degree[st];
    ++degree[en];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += degree[i] * (degree[i] - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}
