passing the length of the array by template