function for counting NAs
added NA counting function