Ahhhh . . . first, I just LOVE that Katy can tell you what's going on with her, that she feels safe enough to share her concerns and upsets with you. Congratulations! You are doing a wonderful job!
Next . . . I know this may be challenging but it would be very good if you could find (or create?!) some opportunities for Katy to connect with other bright children. One possibility is Mensa. Let me know where you are and I'll give you some contact information. She wouldn't have to _join_ Mensa but could attend some activities for bright children.
Another possibility would be activities or classes at museums, science museums or other places offering challenging opportunities for smart children.
I hope you're able to offset the "weird" feedback she's getting from other kids. I hope you (and other significant people) can give her feedback that her extra abilities do not make her weird, just different. The headaches may be caused (in part?) by stress from coping w/being rejected by the other kids.
About the counting . . . I used to count steps.
On my way to and from school and other places,
I would count all my steps.
After I was an adult, I figured out that this was a way
of turning my mind off . . . . so that I wouldn't be stressing over my problems.
At the time, of course, I didn't know this.
I, however, never told anyone I was counting steps.
It sounds like Katy may have told some kids about that.
I hope you're able to get some assistance and/or counseling soon . . . for all of you. As I'm sure you know, she's right on the edge of the most difficult/challenging time, puberty. It would be good if she has a more sturdy structure and self-image as she goes into this period of her life.
Good luck!
S.