```python
def max_product(arr, n ):
    if n == 0:
        return 0

    # dp[i] stores the maximum product of an increasing subsequence
    # ending at index i. Initialize with the array elements themselves.
    dp = list(arr)

    for i in range(1, n):
        for j in range(i):
            # If arr[i] can extend the increasing subsequence ending at arr[j]
            if arr[i] > arr[j]:
                # Update the max product for the subsequence ending at i
                dp[i] = max(dp[i], dp[j] * arr[i])

    # The result is the maximum value in the dp array, as the
    # maximum product increasing subsequence can end at any index.
    return max(dp)
```