Created function to count neighbors of a cell