Reconfigurable intelligent surface (RIS) has been regarded as a promising technique due to its high array gain and low power. However, the traditional passive RIS suffers from the ``double fading'' effect, which has restricted the performance of passive RIS-aided communications. Fortunately, active RIS can alleviate this problem since it can adjust the phase shift and amplify the received signal simultaneously. Nevertheless, a high beamforming gain often requires a number of reflecting elements, which leads to non-negligible power consumption, especially for the active RIS. Thus, one challenge is how to improve the scalability of the RIS and the energy efficiency. Different from the existing works where all reflecting elements are activated, we propose a novel element on-off mechanism where reflecting elements can be flexibly activated and deactivated. Two different optimization problems for passive RIS and active RIS are formulated by maximizing the total energy efficiency. We develop two different alternating optimization-based iterative algorithms to obtain sub-optimal solutions. Furthermore, we consider special cases involving rate maximization problems for given the same total power budget, and respectively analyze the number configuration for passive RIS and active RIS. Simulation results verify that reflecting elements under the proposed algorithms can be flexibly activated and deactivated.