Castelnuovo-Mumford regularity of a homogeneous ideal