Taking special cases at sizes 0 and 1 into account.