Use size property, instead of len function.
a.size
Remarks:
Python’s len function will not give number of elements in NumPy multi-dimensional array.
len
size property is the multiplication of all items in shape property.
size
shape
References: