#include <bits/stdc++.h>
using namespace std;
vector<int> adjl[505050];
long long n, a, b, par[505050], ans;
stack<int> st;
set<int> gone;
queue<pair<int, int> > bfs;
bool visit[505050];
int main() {
  ans = 0;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    adjl[a].push_back(b);
    adjl[b].push_back(a);
  }
  par[1] = 0;
  memset(visit, 0, sizeof visit);
  bfs.push(make_pair(1, 0));
  while (!bfs.empty()) {
    int now = bfs.front().first;
    int dist = bfs.front().second;
    bfs.pop();
    if (visit[now]) continue;
    visit[now] = 1;
    if (dist > 2) st.push(now);
    long long sez = adjl[now].size();
    for (int i = 0; i < sez; i++) {
      bfs.push(make_pair(adjl[now][i], dist + 1));
      if (visit[adjl[now][i]] == 0) par[adjl[now][i]] = now;
    }
  }
  while (!st.empty()) {
    int now = st.top();
    st.pop();
    if (gone.count(now)) continue;
    int x = par[now];
    ans++;
    long long sez = adjl[x].size();
    gone.insert(x);
    for (int i = 0; i < sez; i++) {
      gone.insert(adjl[x][i]);
    }
  }
  cout << ans << "\n";
}
