Parity of ranks of Jacobians of hyperelliptic curves of genus 2