As long as calories in < calories out, the source of those calories matter much less (within reason). You could lose weight eating nothing but oreos and hostess snack cakes as long as calories in < calories out. Not great for you for obvious reasons, not least of which vitamin deficiencies, but you'd lose weight.