
    Given a client's investment preference code string, determine how many characters in the code align with their natural alphabetical positions (1-based indexing, case-insensitive) to assess portfolio compatibility. For example, in 'BALANCED', 'B' at position 1 would count as a match since 'B' is the second letter of the alphabet and appears in position 1, while 'A' at position 2 would not count as it should appear in position 1.
    

    
def count_char_position(str1):
    """
    Given a client's investment preference code string, determine how many characters in the code align with their natural alphabetical positions (1-based indexing, case-insensitive) to assess portfolio compatibility. For example, in 'BALANCED', 'B' at position 1 would count as a match since 'B' is the second letter of the alphabet and appears in position 1, while 'A' at position 2 would not count as it should appear in position 1.
    

    """
def count_char_position(str1):
    """
    Given a client's investment preference code string, determine how many characters in the code align with their natural alphabetical positions (1-based indexing, case-insensitive) to assess portfolio compatibility. For example, in 'BALANCED', 'B' at position 1 would count as a match since 'B' is the second letter of the alphabet and appears in position 1, while 'A' at position 2 would not count as it should appear in position 1.
    

    """
    count_chars = 0
    for i in range(len(str1)):
        if i == ord(str1[i]) - ord('A') or i == ord(str1[i]) - ord('a'):
            count_chars += 1
    return count_chars