Added naive solution. Need to fix this using fenwick tree.