Implementation of size() function.