The number of two-component systems present in a bacterial genome is highly correlated with genome size as well as ecological niche; bacteria that occupy niches with frequent environmental fluctuations possess more histidine kinases and response regulators. New two-component systems may arise by gene duplication or by lateral gene transfer, and the relative rates of each process vary dramatically across bacterial species. In most cases, response regulator genes are located in the same operon as their cognate histidine kinase; lateral gene transfers are more likely to preserve operon structure than gene duplications.