#include <bits/stdc++.h>
using namespace std;
int a[100];
int topq;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  if (n % 2 == 1) {
    cout << -1;
    return 0;
  }
  vector<int> used(n, 0);
  int res = 0;
  function<int(int, int)> dfs = [&](int v, int p) {
    int ret = 0;
    for (int u : g[v]) {
      if (!used[u]) {
        used[u] = 1;
        int sz = dfs(u, v);
        if (sz % 2 == 0) res++;
        ret += sz;
      }
    }
    return ret + 1;
  };
  used[0] = 1;
  dfs(0, -1);
  cout << res;
  return 0;
}
