Counter
Python 3\npython\nclass Solution:\n    def findLonely(self, nums: List[int]) -> List[int]:\n        m = Counter(nums)\n        return [n for n in nums if m[n] =
**Python 3**\n```python\nclass Solution:\n    def findLonely(self, nums: List[int]) -> List[int]:\n        m = Counter(nums)\n        return [n for n in nums if m[n] == 1 and m[n - 1] + m[n + 1] == 0]\n```\n\n**C++**\n```cpp\nvector<int> findLonely(vector<int>& nums) {\n    unordered_map<int, int> m;\n    vector<int> res;\n    for (int n : nums)\n        ++m[n];\n    for (const auto [n, cnt] : m)\n        if (cnt == 1 && m.count(n + 1) == 0 && m.count(n - 1) == 0)\n            res.push_back(n);\n    return res;\n}\n```
['C', 'Python3']