Native Python solution, O(n)
```\nclass Solution(object):\n    def subtractProductAndSum(self, n):\n        """\n        :type n: int\n        :rtype: int\n        """\n        product = 1\
```\nclass Solution(object):\n    def subtractProductAndSum(self, n):\n        """\n        :type n: int\n        :rtype: int\n        """\n        product = 1\n        sums = 0\n        for x in str(n):\n            digit = int(x)\n            product *= digit\n            sums += digit\n            \n        return product - sums
['Python', 'Python3']