Everyone Ought to Have a Friend An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type.  Adjacent characters can be to the left, the right above or below, but not diagonals.  For example in the following text H is isolated:

Ybb
YH%
%%%%


All the other characters are not isolated because each of them has at least one other character of the same type adjacent.

Your task is to write a program that takes a string as input and determines the number of isolated characters.

Scoring

You answer will be scored by two metrics.  The first is the number of isolated characters in your program.  You should aim to minimize this.  The second will be the number of bytes in your program.  You should minimize this as well.  Program size will act as a tie breaker for the first criterion.

Additional Rules


You should support input on the printable ascii range plus any characters you use in your program.
You may consider a line break to either be a newline character or a newline followed by a line feed.
You may take input in any reasonable format.  This includes a list of lines.


Test Cases

Ybb
YH%
%%%%


\$1\$



Aaaab
uuu
yyybbb


\$2\$



A


\$1\$



qqWWaaww


\$0\$
Python 2, 0 (350 344 314 309 301 298 291 bytes)



def f(tt):11
def f(tt):
 tt=tt.split('\n')
 r =0#.split('\n')
#r  0#
#for
 for  ii,ll in enumerate(tt):
  for jj,cc in enumerate(ll):
##for+=1-(
    r+=1-(cc in ll[(jj or 2)-1:jj+2:2]    +''.join(ll[jj:
 jj+1]for ll in tt[(ii or 2)-1:ii+2:2]))##+''.join(ll[jj:
#  +1]for&#32;
#print r
 print r
&#32;


Try it online!

-7 bytes, thanks to Jo King