Sample Code:
Integer counter = [ Select count()
FROM Member__c
Where Age__c > 40];
System.debug(‘Total Number of records: ‘ + counter);