using the property of the majority element