Python || 100% Beats || Simple solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def countPairs(self, nums: List[int]) -> int:\n        c = Counter(nums)\n        ans = 0\n        nums = list(set(nums))\n        for i in nums:\n            hold = str(i)\n            l = len(hold)\n            s = set([i])\n            for j in range(l):\n                for k in range(j + 1, l):\n                    temp = hold[:j] + hold[k] + hold[j + 1:k] + hold[j] + hold[k + 1:]\n                    mid = int(temp)\n                    if mid not in s and mid in c and mid < i:\n                        ans += (c[i] * c[mid])\n                        s.add(mid)\n                    for m in range(l):\n                        for n in range(m + 1, l):\n                            cur = temp[:m] + temp[n] + temp[m + 1:n] + temp[m] + temp[n + 1:]\n                            cur = int(cur)\n                            if cur in s or cur >= i:continue\n                            s.add(cur)\n                            ans += (c[i] * c[cur])\n        for i in c.values():\n            ans += ((i) * (i - 1)) // 2\n        return ans\n```
['Hash Table', 'Python3']