#include <bits/stdc++.h>
using namespace std;
using graph_t = vector<list<int>>;
int dfs(int node, const graph_t& graph, vector<bool>& visited,
        vector<int>& lines) {
  visited[node] = true;
  int dist_1 = 0, dist_2 = 0;
  for (int adj : graph[node]) {
    if (!visited[adj]) {
      ++dist_1;
      dist_2 += dfs(adj, graph, visited, lines);
    }
  }
  lines[node] = dist_1 * (dist_1 - 1) / 2 + dist_2;
  return dist_1;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  graph_t graph(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  vector<bool> visited(n, false);
  vector<int> lines(n);
  dfs(0, graph, visited, lines);
  cout << accumulate(lines.begin(), lines.end(), 0);
}
