Java solution
Complexity\n- Time complexity: O(N2)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# C
# Complexity\n- Time complexity: O(N2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] countOfPairs(int n, int x, int y) {\n        int []res = new int[n];\n        \n        for (int i = 1; i <= n; i++) {\n            for (int j = i + 1; j <= n; j++) {\n                int dist = Math.min(Math.abs(i - j), Math.abs(i - x) + 1 + Math.abs(j - y));\n                dist = Math.min(dist, Math.abs(i - y) + 1 + Math.abs(j - x));\n                res[dist-1] += 2;\n            }\n        }\n        \n        return res;\n    }\n}\n\n```
['Java']