#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int>> v(10005);
long long int visited[10005] = {0}, cnt = 0, strt;
void bfs(long long int x) {
  visited[x] = 1;
  vector<long long int> vex;
  long long int i, j, k, l;
  for (i = 0; i < v[x].size(); i++) {
    vex.push_back(v[x][i]);
  }
  for (i = 0; i < vex.size(); i++) {
    strt = vex[i];
    cnt = cnt + v[strt].size() - 1;
  }
}
int main() {
  long long int n;
  cin >> n;
  long long int i, j, k, l, m, a, b;
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (i = 1; i <= n; i++) {
    if (visited[i] == 0) {
      bfs(i);
    }
  }
  cout << cnt / 2;
}
