import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { static int[][] counts; static int[] parents1; static int[] parents2; static long ans = 0; static List> graph; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new ArrayList<>()); } IntStream.range(0, n - 1).forEach(i -> { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; graph.get(a).add(b); graph.get(b).add(a); }); parents1 = new int[n]; parents2 = new int[n]; counts = new int[n][4]; setValue(0, -1, -1); setAns(0, 0); System.out.println(ans / 2); } static void setValue(int idx, int p1, int p2) { counts[idx][0] = 1; parents1[idx] = p1; parents2[idx] = p2; graph.get(idx).stream().filter(x -> x != p1).forEach(x -> { setValue(x, idx, p1); for (int i = 1; i <= 3; i++) { counts[idx][i] += counts[x][i - 1]; } }); } static void setAns(int idx, int p) { for (int i = 1; i <= 3; i++) { ans += counts[idx][i]; } if (parents1[idx] >= 0) { ans += counts[parents1[idx]][2] - counts[idx][1]; ans += counts[parents1[idx]][1] - 1; ans++; } if (parents2[idx] >= 0) { ans += counts[parents2[idx]][1] - 1; ans++; if (parents2[idx] != 0) { ans++; } } graph.get(idx).stream().filter(x -> x != p).forEach(x -> setAns(x, idx)); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }