Write an SOQL which retrieves all the accounts with related cases.
Assign it to a variable.
Debug the size of the list.
DEBUG|130
List<Account> acList = [SELECT Id, (SELECT Id FROM Cases) FROM Account]; System.debug(acList.size());