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];
            int h = 0;
            int d = 0;
            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)
            {
                if ((lj[0] > 0 && lj[1] > 0) || (lj[0] < 0 && lj[1] < 0))
                {
                    int max = lj[0];
                    int min = lj[1];
                    if (min > max)
                    {
                        int priv = max;
                        max = min;
                        min = priv;
                    }
                    h = Math.Abs(max - min);
                }
                else
                {
                    h = Math.Abs(lj[0]) + Math.Abs(lj[1]);
                }

                if ((ld[0] > 0 && ld[1] > 0) || (ld[0] < 0 && ld[1] < 0))
                {
                    int max = ld[0];
                    int min = ld[1];
                    if (min > max)
                    {
                        int priv = max;
                        max = min;
                        min = priv;
                    }
                    d = Math.Abs(max - min);
                }
                else
                {
                    d = Math.Abs(ld[0]) + Math.Abs(ld[1]);
                }

                if (h / 2 == d)
                {
                    brt++;
                    
                }
                else if (d / 2 == h)
                {
                    brt++;
                   
                } 
            }
            c = 0;
            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    if (k[i].y > k[j].y)
                        razmeni(ref k[i], ref k[j]);

                }
            }
            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)
            {
                if ((lj[0] > 0 && lj[1] > 0) || (lj[0] < 0 && lj[1] < 0))
                {
                    int max = lj[0];
                    int min = lj[1];
                    if (min > max)
                    {
                        int priv = max;
                        max = min;
                        min = priv;
                    }
                     h = Math.Abs(max - min);
                }
                else
                {
                     h = Math.Abs(lj[0]) + Math.Abs(lj[1]);
                }

                if ((ld[0] > 0 && ld[1] > 0) || (ld[0] < 0 && ld[1] < 0))
                {
                    int max = ld[0];
                    int min = ld[1];
                    if (min > max)
                    {
                        int priv = max;
                        max = min;
                        min = priv;
                    }
                     d = Math.Abs(max - min);
                }
                else
                {
                     d = Math.Abs(ld[0]) + Math.Abs(ld[1]);
                }

                if (h / 2 == d)
                {
                    brt++;
                    
                }
                else if (d / 2 == h)
                {
                    brt++;
                    
                }
                
            }
            
            Console.WriteLine(brt);
            
            
        }
    }
}