Write a Python function `count_rotations(arr)` that determines the number of rotations required to sort a given array in ascending order. The array is assumed to be a rotated version of a sorted array.
#### Example Usage:
```python [main.nopy]
print(count_rotations([3, 2, 1])) # Output: 1
print(count_rotations([4, 5, 1, 2, 3])) # Output: 2
print(count_rotations([7, 8, 9, 1, 2, 3])) # Output: 3
print(count_rotations([1, 2, 3])) # Output: 0
```
#### Constraints:
- The input array is a rotated version of a sorted array.
- The array contains distinct integers.
- The function should return the number of rotations required to sort the array.