#include <bits/stdc++.h>
using namespace std;
enum { North, East, South, West };
int mi[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int mj[] = {0, 1, 0, -1, 1, 1, -1, -1};
vector<int> graph[10000 + 35];
bool vis[10000 + 35];
int ans;
void dfs(int x) {
  if (vis[x]) return;
  vis[x] = true;
  for (int i = 0; i < graph[x].size(); i++) {
    int v = graph[x][i];
    ans += graph[v].size() - 1;
    dfs(v);
  }
}
void init() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
  cout << "[FREOPEN]" << endl;
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--, y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  ans = 0;
  for (int i = 0; i < n; i++) dfs(i);
  printf("%d\n", ans / 2);
  return 0;
}
