Java Solution
\nclass Solution {\n    public int[] countOfPairs(int n, int x, int y) {        \n        int[] result = new int[n];\n        int smaller = x > y ? y : x;\n    
```\nclass Solution {\n    public int[] countOfPairs(int n, int x, int y) {        \n        int[] result = new int[n];\n        int smaller = x > y ? y : x;\n        int larger = x > y ? x : y;\n        for (int i = 1; i <= n; i++) {\n            for (int j = i + 1; j <= n; j++) {\n                int distance = Math.min(j - i, Math.abs(i - smaller) + 1 + Math.abs(j - larger));\n                result[distance - 1] = result[distance - 1] + 2;\n            }\n        }\n        return result;\n    }\n}\n```
['Java']