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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/*
 * Copyright (c) --> Arpit
 * Date Created : 17/9/2020
 * Have A Good Day !
 */

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Arpit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        CWatchmen solver = new CWatchmen();
        solver.solve(1, in, out);
        out.close();
    }
    
    static class CWatchmen {
        public void solve(int testNumber, FastReader r, OutputWriter out) {
            int n = r.nextInt();
            HashMap<Integer, Integer> ex = new HashMap<>();
            HashMap<Integer, Integer> ye = new HashMap<>();
            HashMap<CWatchmen.Pair<Integer, Integer>, Integer> freq = new HashMap<>();
            long ans = 0;
            for (int i = 1; i <= n; i++) {
                int x = r.nextInt();
                int y = r.nextInt();
                CWatchmen.Pair p = new CWatchmen.Pair(x, y);
                freq.put(p, freq.getOrDefault(p, 0) + 1);
                ex.put(x, ex.getOrDefault(x, 0) + 1);
                ye.put(y, ye.getOrDefault(y, 0) + 1);
            }
            for (int ele : ex.keySet()) {
                long el = ex.get(ele);
                ans += (el * (el - 1)) / 2; ;
            }
            for (int ele : ye.keySet()) {
                long el = ye.get(ele);
                ans += (el * (el - 1)) / 2;
            }
            for (CWatchmen.Pair p : freq.keySet()) {
                long el = freq.get(p);
                ans -= (el * (el - 1)) / 2;
            }
            out.println(ans);
        }
        
        static class Pair<U, V> implements Comparable<CWatchmen.Pair<U, V>> {
            public U first;
            public V second;
            
            private Pair(U first, V second) {
                this.first = first;
                this.second = second;
            }
            
            public boolean equals(Object o) {
                if (this == o) {
                    return true;
                }
                if (o == null || getClass() != o.getClass()) {
                    return false;
                }
                
                CWatchmen.Pair pair = (CWatchmen.Pair) o;
                
                return !(first != null ? !first.equals(pair.first) : pair.first != null)
                        && !(second != null ? !second.equals(pair.second) : pair.second != null);
            }
            
            public int hashCode() {
                int result = first != null ? first.hashCode() : 0;
                result = 31 * result + (second != null ? second.hashCode() : 0);
                return result;
            }
            
            public String toString() {
                return "(" + first + "," + second + ")";
            }
            
            public int compareTo(CWatchmen.Pair<U, V> o) {
                int value = ((Comparable<U>) first).compareTo(o.first);
                if (value != 0) {
                    return value;
                }
                return ((Comparable<V>) second).compareTo(o.second);
            }
            
        }
        
    }
    
    static class OutputWriter {
        private final PrintWriter writer;
        
        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }
        
        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }
        
        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                writer.print(objects[i]);
                if (i != objects.length - 1) writer.print(" ");
            }
        }
        
        public void println(Object... objects) {
            print(objects);
            writer.println();
        }
        
        public void close() {
            writer.close();
        }
        
    }
    
    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;
        
        public FastReader(InputStream stream) {
            this.stream = stream;
        }
        
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
        
        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        
        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }
        
        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
            
        }
        
    }
}

