We present a simple model of a population of individuals characterized by their genetic structure in the form of a double string of bits and the phenotype following from it. The population is living in an unchanging habitat preferring a certain type of phenotype (optimum). Individuals are unisex, however a pair is necessary for breeding. An individual rejects a mate if the latter's phenotype contains too many bad, i.e. different from the optimum, genes in the same places as the individual's. We show that such strategy, analogous to disassortative mating based on the major histocompatibility complex, avoiding inbreeding and incest, could be beneficial for the population and could reduce considerably the extinction risk, especially in small populations.