#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const double pi = 3.1415926535897932384626433832795028841;
int main() {
  long long n, x, y;
  long long degree[10005];
  for (int i = 0; i < 10005; i++) degree[i] = 0;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    degree[x]++;
    degree[y]++;
  }
  long long ans = 0;
  for (int i = 0; i < n + 1; i++) {
    if (degree[i] == 2) ans++;
    if (degree[i] > 2) ans += ((degree[i]) * (degree[i] - 1) / 2);
  }
  cout << ans << endl;
  return 0;
}
