# Problem Description
The problem involves working with seven-segment displays and logical OR operations. Given a sequence of numbers, we need to determine how many segments would be illuminated (shown in red) after performing a logical OR operation on the segment patterns of all input numbers. The result should count the segments that are active in at least one of the input numbers in their seven-segment display representation.

# Visual Facts
1. Each example shows digital numbers in seven-segment display format.
2. The displays use standard seven-segment representation where each digit is formed by up to 7 segments.
3. Each example demonstrates OR operations between 2-3 different digits.
4. Results are shown with red segments indicating the segments that are active in at least one of the operands.
5. Four different examples are provided:
   - **0 OR 8** results 6 red segments.
   - **5 OR 3** results 6 red segments.
   - **2 OR 6 OR 4** results 7 red segments.
   - **1 OR 4 OR 9** results 6 red segments.

# Visual Patterns
1. Logical Pattern:
   - The red segments in the result represent segments that are ON (active) in at least one of the input numbers.
   - This is effectively a bitwise OR operation on the segment patterns.

2. Segment Activation:
   - Result segments can be present if they appear in any of the input numbers.
   - The number of red segments is always equal to or greater than the maximum number of segments in any input digit.

3. Multiple Input Handling:
   - The operation can handle 2 or more input numbers.
   - When more numbers are involved, more segments tend to be active (red).

4. Segment Rules:
   - The logical OR operation is applied segment-by-segment.
   - Each segment is treated independently.
   - A segment must be present in at least one input number to appear in the result.

# Solution
from typing import List

def solution(numbers: List[int]) -> int:
    """
    Given a sequence of numbers, determine the number of red segments that would be illuminated.

    Parameters:
        numbers (List[int]): A list of integers

    Returns:
        int: The total number of segments that will turn red based on the combination of the input numbers.
    """
    segment_map = {
        0: 0b0111111,
        1: 0b0000110,
        2: 0b1011011,
        3: 0b1001111,
        4: 0b1100110,
        5: 0b1101101,
        6: 0b1111101,
        7: 0b0000111,
        8: 0b1111111,
        9: 0b1101111
    }

    if not numbers:
        return 0

    result = 0b0000000

    for number in numbers:
        result |= segment_map[number]

    red_blocks = bin(result).count('1')

    return red_blocks


# Test Script
def test():
    test_cases = [
        ([0, 1], 6),
        ([3, 5], 6),
        ([5, 3], 6),
        ([2, 3], 6),
        ([4, 5], 6),
        ([6, 7], 7),
        ([8, 9], 7),
        ([2, 6, 4], 7),
        ([7, 8, 9], 7),
        ([1, 2, 3, 4], 7),
        ([5, 6, 7, 8], 7),
        ([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], 7),
        ([1, 3], 5),
        ([1, 4], 4),
    ]

    for i, (numbers, expected_output) in enumerate(test_cases):
        try:
            output = solution(numbers)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`numbers`: {numbers}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message
            
        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`numbers`: {numbers}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {expected_output}"
            )
            assert False, error_message

test()