#include <bits/stdc++.h>
using namespace std;
const long long N = 200005, INF = 1000000000000000000;
long long power(long long a, long long b) {
  if (a == 0) return 0;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a);
    b >>= 1;
    a = (a * a);
  }
  return res;
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(std::numeric_limits<double>::max_digits10);
  ;
  long long n, ans = 0;
  cin >> n;
  vector<long long> v[N];
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (long long i = 1; i <= n; i++) {
    long long l = v[i].size();
    for (long long j = 0; j < l; j++) ans += (v[v[i][j]].size() - 1);
  }
  cout << ans / 2;
}
