import java.util.*;
import java.math.*;
import java.io.*;

class tour_as implements Runnable {
    ArrayList<Integer>[] e;

    int[] a;
    int[] b;

    void dfs(int x, int p) {
        int sumb = 0;
        int bestaminusb = Integer.MAX_VALUE;
        int bestaminusb2 = Integer.MAX_VALUE;
        for (int y : e[x]) {
            if (y != p) {
                dfs(y, x);
                sumb += b[y];
                if (bestaminusb > a[y] - b[y]) {
                    bestaminusb2 = bestaminusb;
                    bestaminusb = a[y] - b[y];
                } else if (bestaminusb2 > a[y] - b[y]) {
                    bestaminusb2 = a[y] - b[y];
                }
            }
        }
        if (bestaminusb < Integer.MAX_VALUE) {
            a[x] = sumb + bestaminusb;
        } else {
            a[x] = 1;
        }
        if (bestaminusb2 < Integer.MAX_VALUE) {
            b[x] = Math.min(sumb + bestaminusb + bestaminusb2 - 1, a[x]);
        } else {
            b[x] = a[x];
        }
    }

    public void solve() throws IOException {
        Scanner in = new Scanner(new File("tour.in"));
        PrintWriter out = new PrintWriter(new File("tour.out"));

        int n = in.nextInt();
        e = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            e[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < n - 1; i++) {
            int x = in.nextInt() - 1;
            int y = in.nextInt() - 1;
            e[x].add(y);
            e[y].add(x);
        }

        a = new int[n];
        b = new int[n];
        dfs(0, -1);
        out.println(Math.min(a[0], b[0]));

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
            throw new AssertionError();
        }
    }

    public static void main(String[] args) {
        new Thread(new tour_as()).start();
    }
}