#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long int N = 1e6 + 30, mod = 998244353;
long long int ans = 0;
vector<vector<int> > adj;
void dfs(int v, int par, int len) {
  if (len > 1) return;
  for (int u : adj[v]) {
    if (u != par) {
      if (len == 1) ans++;
      dfs(u, v, len + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  adj.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 0; i < n; i++) dfs(i, -1, 0);
  cout << ans / 2;
}
