Modify the process to calculate length of array