Constants of motion for superconducting Josephson arrays