using System;

namespace ConsoleApp15
{
    class Program
    {
        struct kordinata
        {
            public int x;
            public int y;
        }
        static void razmeni(ref kordinata a, ref kordinata b)
        {
            kordinata pom = a;
            a = b;
            b = pom;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            kordinata[] k = new kordinata[n];
            for (int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split();
                k[i].x = int.Parse(s[0]);
                k[i].y = int.Parse(s[1]);
            }
            int[] lj = new int[2];
            int[] ld = new int[2];
            int brt = 0;
            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if (k[i].x > k[j].x)
                        razmeni(ref k[i], ref k[j]);

                }
            }
            int c = 0;
            for (int i = 0; i < n-1; i++)
            {
                if (k[i].x==k[i+1].x && c==0)
                {
                    lj[0] = k[i].y;
                    lj[1] = k[i + 1].y;
                    c++;
                }
                else if (k[i].x == k[i + 1].x && c == 1)
                {
                    ld[0] = k[i].y;
                    ld[1] = k[i + 1].y;
                    c++;
                    break;
                }
            }
            if (c==2)
            {
                int j = Math.Abs(lj[0]) + Math.Abs(lj[1]);
                int d = Math.Abs(ld[0]) + Math.Abs(ld[1]);
                if (j / 2 == d) brt++;
                else if (d / 2 == j) brt++;
            }
            c = 0;
            for (int i = 0; i < n - 1; i++)
            {
                if (k[i].y == k[i + 1].y && c == 0)
                {
                    lj[0] = k[i].x;
                    lj[1] = k[i + 1].x;
                    c++;
                }
                else if (k[i].y == k[i + 1].y && c == 1)
                {
                    ld[0] = k[i].x;
                    ld[1] = k[i + 1].x;
                    c++;
                    break;
                }
            }
            if (c == 2)
            {
                int j = Math.Abs(lj[0]) + Math.Abs(lj[1]);
                int d = Math.Abs(ld[0]) + Math.Abs(ld[1]);
                if (j / 2 == d) brt++;
                else if (d / 2 == j) brt++;
            }
            Console.WriteLine(brt);
        }
    }
}