import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Northwest {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;

        String line;
        while ((line = br.readLine()) != null) {
            int count = Integer.parseInt(line);
            HashMap<Integer, Integer> pos = new HashMap<>();
            HashMap<Integer, Integer> neg = new HashMap<>();
            ArrayList<int[]> cords = new ArrayList<>(count);

            for (int i = 0; i < count; i++) {
                String[] parts = br.readLine().split(" ");
                int x = Integer.parseInt(parts[0]);
                int y = Integer.parseInt(parts[1]);

                int vp = x+y;
                if (pos.get(vp) == null) {
                    pos.put(vp, 1);
                } else {
                    pos.put(vp, pos.get(vp)+1);
                }

                int vn = x-y;
                if (neg.get(vn) == null) {
                    neg.put(vn, 1);
                } else {
                    neg.put(vn, neg.get(vn)+1);
                }

                cords.add(new int[]{vp, vn});
            }
            long ch = 0;
            double cc = count*count;
            for (int i = 0; i < count; i++) {
                int[] co = cords.get(i);
                int cp = pos.get(co[0]);
                int cn = neg.get(co[1]);
                if (cp == 1) {
                    cn--;
                } else {
                    cp--;
                }
                ch += (cp*cn);
            }

            System.out.println(ch/cc);
        }

        br.close();
    }
}
