Typescript Count Array Python Memory