You can use collections.Counter to solve this problem with a time complexity of O(N) and a space complexity of also O(N).
from collections import Counter
my_array = [1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
my_counter = Counter(my_array)
# Thanks to @AlexeyBurdin and @Graipher for improving this part.
print(next(k for k, v in my_counter.items() if v % 2))
This will print out all the elementsfirst element which occur foroccurs an odd number of times.
You can read more about collections.Counter here.
This is the simplest and fastest solution I can think of.