from typing import Callable, Optional


def read_input(path: str, *, by_line: bool, fn: Optional[Callable] = None) -> list:
    with open(path, mode='r') as f:
        ret = f.readlines()
        if by_line is not True:
            ret = list(ret)[0].split(',')
        if fn is not None:
            ret = map(fn, ret)
        return list(ret)


def count_matches(iter, fn: Callable) -> int:
    # return len(filter(fn, iter))
    return sum(1 if fn(x) else 0 for x in iter)

556346d7287997a4a9b9ad1182e8fe8d3c9aaf1e
<mask token>

<mask token>


def count_matches(iter, fn: Callable) ->int:
    return sum(1 if fn(x) else 0 for x in iter)

<mask token>


def read_input(path: str, *, by_line: bool, fn: Optional[Callable]=None
    ) ->list:
    with open(path, mode='r') as f:
        ret = f.readlines()
        if by_line is not True:
            ret = list(ret)[0].split(',')
        if fn is not None:
            ret = map(fn, ret)
        return list(ret)


def count_matches(iter, fn: Callable) ->int:
    return sum(1 if fn(x) else 0 for x in iter)

from typing import Callable, Optional


def read_input(path: str, *, by_line: bool, fn: Optional[Callable]=None
    ) ->list:
    with open(path, mode='r') as f:
        ret = f.readlines()
        if by_line is not True:
            ret = list(ret)[0].split(',')
        if fn is not None:
            ret = map(fn, ret)
        return list(ret)


def count_matches(iter, fn: Callable) ->int:
    return sum(1 if fn(x) else 0 for x in iter)

from typing import Callable, Optional


def read_input(path: str, *, by_line: bool, fn: Optional[Callable] = None) -> list:
    with open(path, mode='r') as f:
        ret = f.readlines()
        if by_line is not True:
            ret = list(ret)[0].split(',')
        if fn is not None:
            ret = map(fn, ret)
        return list(ret)


def count_matches(iter, fn: Callable) -> int:
    # return len(filter(fn, iter))
    return sum(1 if fn(x) else 0 for x in iter)
