I'd go with the most straightforward solution as it's not a terribly complicated operation:
Code:
int number_of_slots_that_have_something_other_than_0xff(const unsigned char array[50])
{
int n = 0;
for (int i = 0; i < 50; ++i) {
n += array[i] != 0xFF;
}
return n;
}
Assuming each iteration takes 5 CPU cycles (it may be more or less, depending on the exact CPU, compiler, and optimization level), that takes only 250 CPU cycles, which shouldn't be too much energy/time consumed.
On the other hand, instead of counting the slots frequently, maintain a running counter that increases or decreases by one any time a slot changes from 0xFF to something else or vice versa.