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

namespace ConsoleApp32
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 0,br=0;
            bool c = true;
            n=int.Parse(Console.ReadLine());
            int[,] a = new int[n-1, 2];
        for(int i = 0; i < n-1; i++)
            {
                string[] r = Console.ReadLine().Split();
                for (int j = 0; j <2; j++)
                {
                    a[i, j] = int.Parse(r[j]);
                }
            }
            for (int i = 0; i < n-1; i++)
            {
                for (int j = 0; j < n-1; j++)
                {
                    if (a[i,0] != a[j,0] && j<n/2) c = false;
                }
                if (c) { br = 2; break; }
                if (n % 2 != 0) { br = n - 3 + 1; }
                else { br = n - 4 + 1; }
            }

            Console.WriteLine(br);
            Console.ReadLine();
        }
    }
}