#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> adjl[100007];
int numWays[100007];
int solution;
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adjl[a].push_back(b);
    adjl[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < adjl[i].size(); j++) {
      int t = adjl[i][j];
      numWays[i] += adjl[t].size() - 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    solution += numWays[i];
  }
  solution /= 2;
  cout << solution << endl;
  return 0;
}
