#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
inline void cmin(int &x, int y) {
  if (y < x) x = y;
}
inline void cmax(int &x, int y) {
  if (y > x) x = y;
}
const int MX = 100005;
vector<int> edge[MX];
int val[MX], no = 0, ans = 0;
int dfs(int cur, int par) {
  int i;
  val[cur] = 1;
  for (int i = 0; i < edge[cur].size(); i++) {
    if (edge[cur][i] != par) {
      dfs(edge[cur][i], cur);
      val[cur] += val[edge[cur][i]];
    }
  }
  if (par != 0 && val[cur] % 2 == 0) {
    ans++;
  }
  return 0;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n % 2) return !printf("-1");
  int a, b;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  dfs(1, 0);
  printf("%d", ans);
  return 0;
}
