```python
def tag_count(line: str) -> int:
    if not line.strip().startswith('<'):
        raise ValueError("Line does not start with '<'")

    count = 0
    i = 1
    while i < len(line):
        if line[i] == '>':
            return count
        elif line[i] == '<':
            count += 1
        i += 1

    raise ValueError("Unmatched closing bracket at the end of the line")
```