import numpy as np
import math
nlevels = 3
Counting = 0
for p1 in range(nlevels):
for p2 in range(nlevels):
iconfig = np.zeros(nlevels)
iconfig[p1] += 1
iconfig[p2] += 1
print('%s' % str(iconfig))
Counting += 1
print ('Total number of microstates for this system is', Counting)

```
[2. 0. 0.]
[1. 1. 0.]
[1. 0. 1.]
[1. 1. 0.]
[0. 2. 0.]
[0. 1. 1.]
[1. 0. 1.]
[0. 1. 1.]
[0. 0. 2.]
Total number of microstates for this system is 9
```