#include <bits/stdc++.h>   using namespace std;   int n, siz[500010];   vector<int> v[500010];   class DS {    public:     long long dat[2][2];     DS() { memset(dat, 0, sizeof(dat)); }     DS(long long a00, long long a01, long long a10, long long a11) {       dat[0][0] = a00;       dat[0][1] = a01;       dat[1][0] = a10;       dat[1][1] = a11;     }     DS trans() {       return DS(dat[1][0], dat[0][0] + dat[1][1], dat[0][0], dat[0][1]);     }     DS operator*(const DS &t) const {       DS ret;       for (int i = 0; i < 2; i++) {         for (int j = 0; j < 2; j++) {           for (int k = 0; k + i < 2; k++) {             for (int l = 0; j + l < 2; l++) {               ret.dat[i + k][j + l] += dat[i][j] * t.dat[k][l];             }           }         }       }       return ret;     }   } f[500010], g[500010];   void dfs(int np, int fath) {     f[np] = DS(1, 0, 0, 0);     siz[np] = 1;     for (int &x : v[np]) {       if (x == fath) continue;       dfs(x, np);       siz[np] += siz[x];       f[np] = f[np] * f[x].trans();     }   }   void dfs2(int np, int fath) {     vector<DS> pre;     pre.push_back(DS(1, 0, 0, 0));     for (int i = 0; i < v[np].size(); i++) {       if (v[np][i] == fath)         pre.push_back(pre.back());       else         pre.push_back(pre.back() * f[v[np][i]].trans());     }     DS cur = fath ? g[np].trans() : DS(1, 0, 0, 0);     for (int i = (int)v[np].size() - 1; i >= 0; i--) {       if (v[np][i] == fath) continue;       g[v[np][i]] = cur * pre[i];       dfs2(v[np][i], np);       cur = cur * f[v[np][i]].trans();     }   }   int main() {     scanf( %d , &n);     if (n & 1) {       puts( 0 );       return 0;     }     for (int i = 1, a, b; i < n; i++) {       scanf( %d%d , &a, &b);       v[a].push_back(b);       v[b].push_back(a);     }     dfs(1, 0);     dfs2(1, 0);     long long ans = 0;     for (int i = 2; i <= n; i++) {       if (f[i].dat[1][0] == 1 && g[i].dat[1][0] == 1)         ans += (long long)siz[i] * (n - siz[i]);       else         ans +=             (f[i].dat[0][0] + f[i].dat[1][1]) * (g[i].dat[0][0] + g[i].dat[1][1]);     }     printf( %lld n , ans);     return 0;   }   