#include <bits/stdc++.h>
using namespace std;
const int N = 10001;
bool used[N];
vector<int> g[N];
int main() {
  int n, u, v;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int m = g[i].size();
    if (m > 1) {
      ans += m * (m - 1) / 2;
    }
  }
  cout << ans;
}
