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[n+1, n+1];
            string[] x;
            int br = 0;
            for (int i = 0; i < n; i++)
            {
                x = Console.ReadLine().Split();
                tabla[int.Parse(x[0]), int.Parse(x[1])] = 1;
            }
            for (int i = 1; i < n+1; i++)
            {
                for (int j = 1; j < n+1; j++)
                {
                    if (tabla[i, j] == 1)
                        tabla[i, 0]++;
                    if (tabla[j, i] == 1)
                        tabla[0, i]++;
                }
            }
            int bv = 0, bh = 0;
            int nv = 0, nh = 0;
            for (int i = 1; i < n+1; i++)
            {
                if (tabla[i, 0] == 0)
                    bh++;
                if (tabla[0, i] == 0)
                    bv++;
                if (tabla[0, i] > nv)
                    nv = tabla[0, i];
                if (tabla[i, 0] > nh)
                    nh = tabla[i, 0];
            }
            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);
        }
    }
}