The airline transport pilot reported that the airplane's engine lost power during cruise, and the airplane collided with rocks during the emergency landing on a beach. At the accident site, the right fuel tank was discovered to be empty, and the fuel selector positioned to the right tank. Recovery personnel operating under the supervision of FAA personnel, successfully ran the engine up to 2,300 rpm at a follow-up examination.