I think it's both if that makes sense. There has to be enough of a difference to create a sense of personal development for both sides since people generally become involved in relationships with a certain person for the sake of development and valuing another person's thought process. However, there has to be enough of a basis of similarity to identify certain aspects of the person that would make both parties feel comfortable establish an emotional connection and provide a certain sense of security and comfort.