If you have $M$ marked element, then the number of iterations should be

$$\frac{\pi}{4}\sqrt{\frac{N}{M}}  \text{where},\;\;\;  N = 2^n $$ 

So, you need to replace this line
```pythin
iterations = np.pi/4*np.sqrt(2**n)
```

with

```pythin
iterations = np.pi/4*np.sqrt(2**n / 3)
```