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

namespace petlja2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[,] tabla = new int[2, n];
            string[] x;
            int br = 0;
            for (int i = 0; i < n; i++)
            {
                x = Console.ReadLine().Split();
                tabla[0, int.Parse(x[0])-1]++;
                tabla[1, int.Parse(x[1])-1]++;
            }
            int bv = 0, bh = 0;
            int nv = 0, nh = 0;
            for (int i = 0; i < n; i++)
            {
                if (tabla[0, i] == 0)
                    bh++;
                if (tabla[1, i] == 0)
                    bv++;
                if (tabla[0, i] > nv)
                    nv = tabla[0, i];
                if (tabla[1, i] > nh)
                    nh = tabla[1, i];
            }
            if (bv == 0 && bh == 0)
                br = 0;
            else if (bh == 0 && bv != 0)
                br = bv;
            else if (bh != 0 && bv == 0)
                br = bh;
            else if (bh > bv)
            {
                if (nv == nh && bh > nv)
                    br = bh;
                else if (nv == nh)
                    br = nv;
                else if (nh > bh)
                    br = nh;
                else if (nv > bh)
                    br = nv;
            }
            else if (bv > bh)
            {
                if (nv == nh && bv > nv)
                    br = bv;
                else if (nv == nh)
                    br = nv;
                else if (nh > bv)
                    br = nh;
                else if (nv > bv)
                    br = bv;
            }
            else if (bv == bh && nh == nv)
                br = nv;
            else if (bv == bh)
                br = bh;
            Console.WriteLine(br);
        }
    }
}