n = len of array