Yes, they can. This is the only way to breed Genderless Pokemon, and boy Pokemon, without a Pokemon of the same egg group that is female.
EDIT: Just for the community (And your comment), Ditto will not breed with Ditto. It is meant to be the fill-in of the other Pokemon, since a single Pokemon cannot breed.