#include <bits/stdc++.h>
using namespace std;
vector<int> a[100005];
int ans = 0;
void dfs(int x, int d, int p) {
  if (d == 0) {
    ans++;
    return;
  }
  for (int i = 0; i < a[x].size(); i++)
    if (a[x][i] != p) dfs(a[x][i], d - 1, x);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    dfs(i, 2, -1);
  }
  cout << ans / 2 << endl;
}
