Lonely Integer hackerrank solution in python