#include <iostream>
#include <vector>
#include <queue>
using namespace std;

const int maxn = 300010;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<vector<int>> g(n + 1);
    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    vector<int> fa(n + 1, 0);
    vector<int> dep(n + 1, 0);
    vector<long long> size_arr(n + 1, 1);
    vector<long long> sum_sq(n + 1, 0);
    vector<int> nodes;

    queue<int> q;
    q.push(1);
    fa[1] = 0;
    dep[1] = 0;
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        nodes.push_back(u);
        for (int v : g[u]) {
            if (v == fa[u]) continue;
            fa[v] = u;
            dep[v] = dep[u] + 1;
            q.push(v);
        }
    }

    for (int i = nodes.size() - 1; i >= 0; i--) {
        int u = nodes[i];
        if (fa[u] != 0) {
            size_arr[fa[u]] += size_arr[u];
            sum_sq[fa[u]] += size_arr[u] * size_arr[u];
        }
    }

    long long ans = 0;
    for (int u = 1; u <= n; u++) {
        long long count_u = size_arr[u] * size_arr[u] - sum_sq[u];
        ans += (long long)u * count_u;
    }

    cout << ans << endl;
    return 0;
}