#include <bits/stdc++.h>
using namespace std;
int setBit(int n, int pos) { return n = n | (1 << pos); }
int resetBit(int n, int pos) { return n = n & ~(1 << pos); }
bool checkBit(long long n, long long pos) { return (bool)(n & (1LL << pos)); }
const int MAX = 100010;
vector<int> ed[MAX];
int sub[MAX];
int par[MAX];
void dfs(int s, int p) {
  sub[s] = 1;
  par[s] = p;
  for (auto x : ed[s]) {
    if (x != p) {
      dfs(x, s);
      sub[s] += sub[x];
    }
  }
}
int main() {
  int n, u, v;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    ed[u].push_back(v);
    ed[v].push_back(u);
  }
  dfs(1, -1);
  int cnt = 0;
  for (int i = 2; i <= n; i++) {
    v = i;
    if (sub[v] % 2 == 0 and (n - sub[v]) % 2 == 0) {
      cnt++;
    }
  }
  if (cnt == 0 and n % 2 == 1) cnt = -1;
  printf("%d\n", cnt);
  return 0;
}
