what country gained its independence from spain in 1816?