Miguel and His Dream House

Miguel is ready to build his dream house in honor of his great grandfather Hector. There is an Array of Length N containing the heights of N bricks. Each integer Ai denoting the height of i-th brick. Miguel will choose a range of bricks so that his great grandmother Mamá Imelda will be happy. She will be happy if the range contains every distinct height even number of times.

This is a companion discussion topic for the original entry at https://toph.co/p/miguel-and-his-dream-house