集合A={0,2,a},B={1,a2},若A∪B={0,1,2,4,16},则a的值为______.