#include <bits/stdc++.h>
using namespace std;
bool vis[100005];
vector<long long> v[100005];
long long dfs(long long n) {
  vis[n] = true;
  for (long long i = 0; i < v[n].size(); i++) {
    long long k = v[n][i];
    if (vis[k] != true) {
      dfs(k);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1, tmp;
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> j >> k;
    v[j].push_back(k);
    v[k].push_back(j);
  }
  sum = 0;
  for (i = 1; i <= n; i++) {
    k = v[i].size();
    sum += (k * (k - 1)) / 2;
  }
  cout << sum << endl;
}
