#include <stdio.h>
//四方は何かの使わない数(-1など=UNUSEと置く)で埋めるのでARRAY_X/Y+2を確保
int array[ARRAY_Y + 2][ARRAY_X + 2];
/*
1 0 7
2 # 6
3 4 5
*/
int lookx[8] = {0,-1,-1,-1,0,1,1,1};
int looky[8] = {1,1,0,-1,-1,-1,0,1};
int ans = 0;
void exect(int x , int y , int num) {
int i;
if (array[y][x] == num) {
array[y][x] = UNUSE;
ans++;
for (i = 0 ; i < 8 ; i++) {
exect(x + lookx[i] , y + looky[i] , num);
}
}
}
int main(void) {
exect(a , b , number);
printf("%d" , ans);
return 0;
}