#include <bits/stdc++.h>
clock_t t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T& x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T& t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(register int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ret = ret * x;
  return ret;
}
}  // namespace my_std
using namespace my_std;
int n;
struct hh {
  int t, nxt;
} edge[500101 << 1];
int head[500101], ecnt;
void make_edge(int f, int t) {
  edge[++ecnt] = (hh){t, head[f]};
  head[f] = ecnt;
  edge[++ecnt] = (hh){f, head[t]};
  head[t] = ecnt;
}
int size[500101];
int up[500101], dn[500101];
void dfs1(int x, int fa) {
  size[x] = 1;
  int c = 0;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa)
      dfs1(edge[i].t, x), c += (dn[edge[i].t] == -1 ? 233 : dn[edge[i].t]),
          size[x] += size[edge[i].t];
  if (c > 1)
    dn[x] = -1;
  else
    dn[x] = c ^ 1;
}
void dfs2(int x, int fa) {
  if (!fa) up[x] = 1;
  int c = 0;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) c += (dn[edge[i].t] == -1 ? 233 : dn[edge[i].t]);
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) {
      if (up[x] == -1) {
        up[edge[i].t] = -1;
        dfs2(edge[i].t, x);
        continue;
      }
      int cc = c - (dn[edge[i].t] == -1 ? 233 : dn[edge[i].t]);
      if (cc == 0)
        up[edge[i].t] = up[x] ^ 1;
      else if (cc == 1 && up[x])
        up[edge[i].t] = 1;
      else
        up[edge[i].t] = -1;
      dfs2(edge[i].t, x);
    }
}
long long F[500101][2], G[500101][2];
void dfs3(int x, int fa) {
  int c = 0;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) c += (dn[edge[i].t] == -1 ? 233 : dn[edge[i].t]);
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) {
      dfs3(edge[i].t, x);
      int cc = c - (dn[edge[i].t] == -1 ? 233 : dn[edge[i].t]);
      if (cc > 1) continue;
      if (cc == 0)
        F[x][0] += F[edge[i].t][1], F[x][1] += F[edge[i].t][0];
      else
        F[x][0] += F[edge[i].t][0];
    }
  if (c == 0) ++F[x][0];
}
long long sum[500101][4][2];
void dfs4(int x, int fa) {
  int c = 0;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) c += (dn[edge[i].t] == -1 ? 2 : dn[edge[i].t]);
  if (c <= 3)
    for (int k = (0); k <= (1); k++) sum[x][c][k] += G[x][k];
  c += (up[x] == -1 ? 2 : (up[x] ^ 1));
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) {
      int cc = c - (dn[edge[i].t] == -1 ? 2 : dn[edge[i].t]);
      if (cc <= 3)
        for (int k = (0); k <= (1); k++) sum[x][cc][k] += F[edge[i].t][k];
    }
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) {
      int cc = c - (dn[edge[i].t] == -1 ? 2 : dn[edge[i].t]);
      if (cc <= 3)
        for (int k = (0); k <= (1); k++) sum[x][cc][k] += -F[edge[i].t][k];
      for (int c = ((dn[edge[i].t] == -1 ? 2 : dn[edge[i].t])); c <= (3); c++) {
        int cc = c - (dn[edge[i].t] == -1 ? 2 : dn[edge[i].t]);
        if (cc > 1) continue;
        if (cc == 0)
          G[edge[i].t][0] += sum[x][c][1], G[edge[i].t][1] += sum[x][c][0];
        else
          G[edge[i].t][0] += sum[x][c][0];
      }
      if (cc == 0) ++G[edge[i].t][0];
      dfs4(edge[i].t, x);
      if (cc <= 3)
        for (int k = (0); k <= (1); k++) sum[x][cc][k] += F[edge[i].t][k];
    }
}
int main() {
  file();
  read(n);
  int x, y;
  for (int i = (1); i <= (n - 1); i++) read(x, y), make_edge(x, y);
  dfs1(1, 0), dfs2(1, 0);
  dfs3(1, 0);
  dfs4(1, 0);
  long long ans = 0;
  for (int x = (2); x <= (n); x++)
    if (!dn[x] && up[x] == 1)
      ans += 1ll * size[x] * (n - size[x]);
    else
      ans += 1ll * F[x][0] * G[x][0];
  cout << ans;
  return 0;
}
