#include <bits/stdc++.h>
using namespace std;
vector<int> g[10010];
long long calc(int n) {
  if (n <= 1)
    return 0;
  else
    return (n - 1) * n / 2;
}
int main(void) {
  int N;
  cin >> N;
  for (int i = 0; i < int(N - 1); ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  long long res = 0;
  for (int i = 1; i <= int(N); ++i) {
    res += calc(g[i].size());
  }
  cout << res << endl;
  return 0;
}
