#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int a, b;
  vector<int> deg;
  ios::sync_with_stdio(false);
  cin >> N;
  deg.resize(N, 0);
  for (int i = 1; i < N; i++) {
    cin >> a >> b;
    a--;
    b--;
    deg[a]++;
    deg[b]++;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) ans += deg[i] * (deg[i] - 1) / 2;
  cout << ans << endl;
  return 0;
}
