1> Count is calculated From the Sequence Number(SN) and Hyper Frame Number(HFN) of the PDU.
2> As the count is used to calculate the ciphering key and integrity key so count is same for both Key generation .
Ciphering Key generation
f8 Algorithm is used for this.
Please see this figure for inputs and outputs of this algorithm

Integrity Key generation
f9 Algorithm is used for this
Please see this figure for inputs and outputs of this algorithm

For Security algorithms u can refer to Spec 35.201
Best book is LTE Security by Günther Horn