Simple java solution
Complexity\n- Time complexity: O(n^2)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n    public int[] countOfPairs(int n, int x, int y) {\n        i
# Complexity\n- Time complexity: $$O(n^2)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n    public int[] countOfPairs(int n, int x, int y) {\n        int ans[] = new int[n];\n        for(int i=1;i<=n;i++)\n        {\n            for(int j=i+1;j<=n;j++)\n            {\n                int val = Math.min(Math.abs(i-j),Math.min(Math.abs(i-x)+1+Math.abs(y-j),Math.abs(i-y)+1+Math.abs(x-j)));\n                ans[val-1]+=2;\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']