#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, l, m, t;
  vector<int> a[10001];
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> m >> t;
    a[m].push_back(t);
    a[t].push_back(m);
  }
  l = 0;
  m = 0;
  int b[30001], c[30001];
  for (t = 1; t <= n; t++) {
    j = 0;
    for (i = 0; i < a[t].size(); i++) {
      j++;
      b[j] = a[t][i];
    }
    l = 0;
    for (i = 1; i <= a[t].size(); i++) {
      for (j = 0; j < a[b[i]].size(); j++) {
        l++;
        c[l] = a[b[i]][j];
      }
    }
    for (i = 1; i <= l; i++)
      if (c[i] > t) m++;
  }
  cout << m << endl;
}
