```python
def max_sum(arr, n):
    """
    Calculates the maximum sum of a bi-tonic sub-sequence for the given array.
    A bi-tonic sub-sequence is one which is first strictly increasing and then
    strictly decreasing.
    """
    if n == 0:
        return 0

    # msis[i] stores the maximum sum of an increasing subsequence ending at arr[i]
    msis = list(arr)
    for i in range(1, n):
        for j in range(i):
            if arr[i] > arr[j] and msis[i] < msis[j] + arr[i]:
                msis[i] = msis[j] + arr[i]

    # msds[i] stores the maximum sum of a decreasing subsequence starting at arr[i].
    # This is calculated by finding the maximum sum of a decreasing subsequence
    # ending at arr[i] by iterating from right to left.
    msds = list(arr)
    for i in range(n - 2, -1, -1):
        for j in range(n - 1, i, -1):
            if arr[i] > arr[j] and msds[i] < msds[j] + arr[i]:
                msds[i] = msds[j] + arr[i]

    # Find the maximum sum of a bitonic subsequence.
    # A bitonic subsequence with peak at arr[i] has the sum
    # msis[i] + msds[i] - arr[i]. We subtract arr[i] because it is
    # included in both msis[i] and msds[i].
    max_val = msis[0] + msds[0] - arr[0]
    for i in range(1, n):
        current_sum = msis[i] + msds[i] - arr[i]
        if current_sum > max_val:
            max_val = current_sum

    return max_val
```