#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    map<int, vector<int>> m;
    n--;
    while (n--) {
      int a, b;
      cin >> a >> b;
      m[a].push_back(b);
      m[b].push_back(a);
    }
    int ans = 0;
    for (auto i : m) {
      ans += (i.second.size() * (i.second.size() - 1)) / 2;
    }
    cout << ans << "\n";
  }
  return 0;
}
