Thinking Caps On

A co-worker just sent me this little brainteaser:

This puzzle was given to candidates as part of an entrance examination to a specialized kindergarten program:

8809 = 6
2132 = 0
6666 = 4
1111 = 0
3213 = 0
7663 = 2
9312 = 1
0000 = 4
2222 = 0
3333 = 0
5555 = 0
8193 = 3
8096 = 5
7777 = 0
9999 = 4
7756 = 1
6855 = 3
9881 = 5
5531 = 0

2581 = ?

If you’re stumped, you can email me for the answer.

Related content from Sphere