```ts
export function tagCount(line: string): number {
  let markerCount = 0;
  let inMarker = false;

  for (const char of line) {
    if (char === '<') {
      if (!inMarker) {
        inMarker = true;
        markerCount++;
      }
    } else if (char === '>') {
      if (inMarker) {
        inMarker = false;
      } else {
        throw new Error("Unmatched closing bracket found.");
      }
    }
  }

  return markerCount;
}
```