using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] nr = new int[n];
            int[] nk = new int[n];
            for (int i = 0; i < n-1; i++)
            {
                string s;
                s = Console.ReadLine();
                string[] words = s.Split(' ');
                foreach (var word in words)
                {
                    nr[i] = int.Parse(words[0]);
                    nk[i] = int.Parse(words[1]);
                }
            }
            int[]b = new int[n+1];
            int br = 1;
            for (int i = 0; i <n; i++)
            {
                for (int j =1 ; j <n+1; j++)
                {
                    if (nr[i] == j) b[j]++;
                    if (nk[i] == j) b[j]++;
                }
                                
            }

            for (int i = 0; i < n+1; i++)
            {
                if (b[i] > 2) br = 2;
            }



            if (n <= 5)
            {
                if (n % 2 == 1) n = n + 1;
               Console.WriteLine(n / 2 - 1);
            }
            else if (n >5)
            {
                if (n % 2 == 1) n = n + 1;
                Console.WriteLine(n / 2 - br);
            }



        }
    }
}