Nice problem. O(N) for reading or O(1024^2)