An m×n lamp pattern is a distribution of the on-off states of the mn lamps arranged in an m×n rectangular array. If one touches one of the lamps, then the on-off status of that lamp, and of the vertically-adjacent or horizontally-adjacent lamps will all be reversed. This is a basic transition, and these transitions applied successively define an equivalence relation among the set of the m×n lamp patterns. This paper is concerned with determination of the number of the equivalence classes of the m×n lamp patterns. It is shown that the class number is given by 2^d, with the degree d of the polynomial G.C.D. (det (xI_n-A_n), det ((x-1)I_m-A_m)), where I_n is the unit matrix and A_n is the incidence matrix of a basic transition, containing 1 on the two lines parallel and adjacent to the main diagonal and 0 elsewhere.