count a b n = go a (farey a n) b n 0 where
    go a b f n r = if b == f
        then r
        else go b next f n $! (r + 1) -- strict
        where next = farey2 a b n
count a b n = go a (farey a n) b n 0 where
    go a b f n r = if b == f
        then r
        else go b next f n $! (r + 1) -- strict
        where next = farey2 a b n
count a b n = go a (farey a n) b n 0 where
    go a b f n r = if b == f
        then r
        else go b next f n $! (r + 1) -- strict
        where next = farey2 a b n