Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).

They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers the distance between watchmen i and j to be |xi - xj| + |yi - yj|. Daniel, as an ordinary person, calculates the distance using the formula <image>.

The success of the operation relies on the number of pairs (i, j) (1 ≤ i < j ≤ n), such that the distance between watchman i and watchmen j calculated by Doctor Manhattan is equal to the distance between them calculated by Daniel. You were asked to compute the number of such pairs.

Input

The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen.

Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109).

Some positions may coincide.

Output

Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel.

Examples

Input

3
1 1
7 5
1 5


Output

2


Input

6
0 0
0 1
0 2
-1 1
0 1
1 1


Output

11

Note

In the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and <image> for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances.
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by rezat on 28/09/2017.
 */
public class Main {
    public static class Mokhtasat implements Comparable {
        public int x, y;

        public Mokhtasat(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return x + ":" + y ;
        }

        @Override
        public int compareTo(Object o) {
            Mokhtasat t = (Mokhtasat) o;
            if (this.x > t.x)
                return 2;
            if (this.x < t.x)
                return -2;
            if (this.y > t.y)
                return 1;
            if (this.y < t.y)
                return -1;
            return 0;
        }
    }
    public static void main(String[] args) {
        Scanner sn = new Scanner(System.in);
        int n = sn.nextInt();
        int[] t1=new int[n];
        int[] t2=new int[n];
        Mokhtasat [] t3 =new Mokhtasat[n];
        for (int i = 0; i < n; i++) {
            t1[i] = sn.nextInt();
            t2[i] = sn.nextInt();
            t3[i]=new Mokhtasat(t1[i],t2[i]);
        }
//        System.out.println(COUNT(t1));
//        System.out.println(COUNT(t2));
//        System.out.println(COUNT(t3));
        long a = COUNT(t1)+COUNT(t2)-COUNT(t3);
        System.out.print(a);
    }
    public static long COUNT(int[] t)
    {
        Arrays.sort(t);
        //System.out.println(Arrays.toString(t));
        long c=0;
        long g=1;
        for (int i = 1; i <t.length ; i++) {
            if(t[i]!=t[i-1]) {
                if(g>1)
                    c+=(g*(g-1))/2;
                g = 1;
                continue;
            }
            g++;
        }
        if(g>1)
            c+=(g*(g-1))/2;
        return c;
    }

    public static long COUNT(Mokhtasat[] t)
    {
        Arrays.sort(t);
        long c=0;
        long g=1;
        for (int i = 1; i <t.length ; i++) {
            if(t[i].compareTo(t[i-1])!=0) {
                if(g>1)
                    c+=(g*(g-1))/2;
                g = 1;
                continue;
            }
            g++;
        }
        if(g>1)
            c+=(g*(g-1))/2;
        return c;
    }
    /*
        public static void main(String[] args) {
        Scanner sn = new Scanner(System.in);
        int n = sn.nextInt();
        long[][] m = new long[n][2];
        for (int i = 0; i < n; i++) {
            m[i][0] = sn.nextInt();
            m[i][1] = sn.nextInt();
        }
        int a = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (m[i][0] - m[j][0] == 0 || m[i][1] - m[j][1] == 0)
                    a++;
            }
        }
        System.out.print(a);
    }
    */
    /*
public class Main {
    public static class Mokhtasat implements Comparable {
        public int x, y;

        public Mokhtasat(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return x + ":" + y ;
        }

        @Override
        public int compareTo(Object o) {
            Mokhtasat t = (Mokhtasat) o;
            if (this.x > t.x)
                return 2;
            if (this.x < t.x)
                return -2;
            if (this.y > t.y)
                return 1;
            if (this.y < t.y)
                return -1;
            return 0;
        }
    }
    public static class BinarySearchTree<E extends Comparable> {
        public class Node<E extends Comparable> implements Comparable {
            E data;
            long count;
            Node Rchild;
            Node Lchild;

            public Node(E data) {
                this.data = data;
                Rchild = null;
                Lchild = null;
                count = 1;
            }

            public long getCount() {
                return (count*(count-1))/2;
            }

            public void setCount(long count) {
                this.count = count;
            }

            public void increase() {
                count++;
            }

            public void decrease() {
                count--;
            }

            public E getData() {
                return data;
            }

            public void setData(E data) {
                this.data = data;
            }

            public Node getRchild() {
                return Rchild;
            }

            public void setRchild(Node rchild) {
                Rchild = rchild;
            }

            public Node getLchild() {
                return Lchild;
            }

            public void setLchild(Node lchild) {
                Lchild = lchild;
            }

            public int getLinks() {
                if (this.getLchild() != null && this.getRchild() != null)
                    return 3;
                if (this.getLchild() != null && this.getRchild() == null)
                    return 2;
                if (this.getLchild() == null && this.getRchild() != null)
                    return 1;
                return 0;
            }

            @Override
            public int compareTo(Object o) {
                return this.getData().compareTo(((Node) o).getData());
            }

            @Override
            public String toString() {
                return data +":"+ count;
            }
        }

        private Node root;
        private long temp;

        public BinarySearchTree() {
            this.root = null;
            temp=0;
        }

        public void addNumber(E x) {
            if (root == null) {
                root = new Node(x);
                return;
            }
            Node p = new Node(x);
            Node temp = root;
            while (true) {
                if (x.compareTo(temp.getData()) > 0) {
                    if (temp.getRchild() == null) {
                        temp.setRchild(p);
                        break;
                    }
                    temp = temp.getRchild();
                } else if (x.compareTo(temp.getData()) < 0) {
                    if (temp.getLchild() == null) {
                        temp.setLchild(p);
                        break;
                    }
                    temp = temp.getLchild();
                } else {
//                    System.out.print(this.temp+":");
                    this.temp-=temp.getCount();
                    temp.increase();
                    this.temp+=temp.getCount();
//                    System.out.print(this.temp+"\n");
                    break;
                }
            }
        }

        public void printLVR(Node t) {
            if (t!=null)
            {
                printLVR(t.getLchild());
                System.out.print(t+",");
                printLVR(t.getRchild());
            }
        }
        public void printLVR() {
            printLVR(root);
            System.out.println();
        }

        public long getNodesNo() {
//            if (root == null)
//                return 0;
//            temp = 0;
//            VLRNodesNo(root);
            return temp;
        }

        public void VLRNodesNo(Node t) {
            if (t != null) {
                //System.out.println(t.count);
                temp+=t.getCount();
                VLRNodesNo(t.getLchild());
                VLRNodesNo(t.getRchild());
            }
        }

    }
    public static void main(String[] args) {
        Scanner sn = new Scanner(System.in);
        int n = sn.nextInt();
        int p,q;
        BinarySearchTree<Integer>   t1=new BinarySearchTree<>();
        BinarySearchTree<Integer>   t2=new BinarySearchTree<>();
        BinarySearchTree<Mokhtasat> t3=new BinarySearchTree<>();
        for (int i = 0; i < n; i++) {
            p = sn.nextInt();
            q = sn.nextInt();
            t1.addNumber(p);
            t2.addNumber(q);
            t3.addNumber(new Mokhtasat(p,q));
        }
        t1.printLVR();
        t2.printLVR();
        t3.printLVR();
        System.out.println(t1.getNodesNo());
        System.out.println(t2.getNodesNo());
        System.out.println(t3.getNodesNo());
        long a = t1.getNodesNo()+t2.getNodesNo()-t3.getNodesNo();
        System.out.print(a);

    }
    */
    /* 10
46 -55
46 45
46 45
83 -55
46 45
83 -55
46 45
83 45
83 45
46 -55
*/
}
