If you test this program on a sequence generated by randomly drawing zeros and ones with equal probabilities, the average number of occurrences of "11" is about one fourth of the sequence length (to be precise: sequence length minus one because there are only n–1 places for a subsequence of length two in a sequence of length n). This can be explained based on the fact that the probability of getting two ones in a row is precisely one fourth, or 25%.