Storing data locally involves using key, value pairs. As far as I know, it may not be possible to retrieve all values with a specific prefix.
One approach could be to save an object that includes these values. Depending on your requirements, you can store the objects in an array or object and then fetch the entire set to determine the count.
For instance:
var chats = { count: 0 };
chats["chat_"+email] = data;
chats.count += 1;
localStorage.setItem('chats', data);
Then, to get the count, you would access the object:
var chats = localStorage.getItem('chats');
//chats.count will provide the count.
However, this means you need to manually update the count variable when adding or removing data. If you don't require indexing capability, you could add the chats to an array and store that instead.
EDIT: It has been noted that it is feasible to locate properties with a certain prefix, as described in another response to this query.