#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
void solve() {
  int n;
  cin >> n;
  vector<int> g[n];
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    int isit = g[i].size();
    isit = isit * (isit - 1) / 2;
    cnt += isit;
  }
  cout << cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
