/**
  
 count x on [L..R] 

 */

b[] = {pair(a[i], i)}
sort(b)

answer = BS(pair(x, R+1)) - BS(pair(x, L))