The single large or several small (SLOSS) problem has been addressed in a large number of empirical and theoretical studies, but no coherent conclusion has yet been reached. Here I study the SLOSS problem in the context of metapopulation dynamics. I assume that there is a fixed total amount A(0) of habitat available, and I derive formulas for the optimal number n and area A of habitat patches, where n=A(0)/A. I consider optimality in two ways. First, I attempt to maximize the time to metapopulation extinction, which is a relevant measure for metapopulation viability for rare and threatened species. Second, I attempt to maximize the metapopulation capacity of the habitat patch network, which corresponds both with maximizing the distance to the deterministic extinction threshold and with maximizing the fraction of occupied patches. I show that in the typical case, a small number of large patches maximizes the metapopulation capacity, while an intermediate number of habitat patches maximizes the time to extinction. The main conclusion stemming from the analysis is that the optimal number of patches is largely affected by the relationship between habitat patch area and rates of immigration, emigration and local extinction. Here this relationship is summarized by a single factor zeta, termed the patch area scaling factor.