Accounts have a custom field Number_of_Contacts__c. Keep it accurate with an after insert and after delete trigger on Contact.
For every Account touched by the DML, recompute the number of Contacts that reference it and update the Account.
This is the classic roll-up summary on a lookup interview question. It must survive bulk loads of 600 contacts spread across many accounts — aggregate SOQL + one DML per chunk is the expected pattern.
SELECT AccountId, COUNT(Id) n FROM Contact WHERE AccountId IN :ids GROUP BY AccountId.