#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 501000;
int n, u, v, par[N], ev[N], sz[N], ret[N];
pair<int, int> dp[N], pd[N], fp[N], fs[N];
long long ans;
vector<int> e[N];
pair<int, int> gao(pair<int, int> a, pair<int, int> b) {
  if (a.first > b.first)
    return a;
  else if (a.first < b.first)
    return b;
  else
    return make_pair(a.first, a.second + b.second);
}
void dfs(int u, int f) {
  par[u] = 1;
  sz[u] = 1;
  ev[u] = 0;
  dp[u] = make_pair(0, 1);
  for (auto v : e[u])
    if (v != f) {
      dfs(v, u);
      par[u] ^= par[v];
      sz[u] += sz[v];
      ev[u] += ev[v];
      if (par[v] == 0) {
        ev[u]++;
        dp[u] = gao(dp[u], make_pair(dp[v].first - 1, dp[v].second));
      } else {
        dp[u] = gao(dp[u], make_pair(dp[v].first + 1, dp[v].second));
      }
    }
  if (par[u] == 1) {
    assert(ev[u] + dp[u].first <= sz[u] / 2);
    if (ev[u] + dp[u].first != sz[u] / 2)
      ret[u] = 0;
    else
      ret[u] = dp[u].second;
  }
}
void dfs2(int u, int f) {
  vector<int> s;
  s.push_back(u);
  for (auto v : e[u])
    if (v != f) {
      s.push_back(v);
    }
  int m = ((int)(s).size());
  fp[0] = gao(pd[u], make_pair(0, 1));
  for (int i = 1; i < m; i++) {
    int v = s[i];
    if (par[v] == 0)
      fp[i] = gao(fp[i - 1], make_pair(dp[v].first - 1, dp[v].second));
    else
      fp[i] = gao(fp[i - 1], make_pair(dp[v].first + 1, dp[v].second));
  }
  fs[m] = make_pair(-(1 << 30), 0);
  for (int i = m - 1; i >= 1; i--) {
    int v = s[i];
    if (par[v] == 0)
      fs[i] = gao(fs[i + 1], make_pair(dp[v].first - 1, dp[v].second));
    else
      fs[i] = gao(fs[i + 1], make_pair(dp[v].first + 1, dp[v].second));
  }
  for (int i = 1; i < m; i++) {
    int v = s[i];
    pd[v] = gao(fp[i - 1], fs[i + 1]);
    if (par[v] == 1) {
      assert(ev[1] - ev[v] + pd[v].first <= (n - sz[v]) / 2);
      if (ev[1] - ev[v] + pd[v].first == (n - sz[v]) / 2) {
        ans += (long long)pd[v].second * ret[v];
      }
    }
    if (par[v] == 0)
      pd[v].first--;
    else
      pd[v].first++;
  }
  for (int i = 1; i < m; i++) {
    int v = s[i];
    dfs2(v, u);
  }
}
int main() {
  scanf("%d", &n);
  if (n % 2 == 1) {
    puts("0");
    return 0;
  }
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs(1, 0);
  if (ev[1] == n / 2 - 1) {
    for (int i = 2; i < n + 1; i++)
      if (par[i] == 0) ans = ans + (long long)sz[i] * (n - sz[i]);
  }
  dfs2(1, 0);
  printf("%lld\n", ans);
}
