How to find index of n-th value equal to a specific value

a=torch.randint(3, (10,))

tensor([2, 2, 0, 2, 2, 2, 2, 0, 1, 2])

Now I want to find the index of 3rd value equal to 2, which is 3 in this example. Because

a[0]=2, a[1]=2, a[3]=2

How can I do this?

I think that one should work