input: from typing import List
  
  def count_alternating_groups(colors: List[int]) -> int:
      """
      Imagine a circle made of red and blue tiles. You have an array of integers called colors. The color of each tile is defined by colors[i]:
  
      colors[i] == 0 indicates that tile i is red.
      colors[i] == 1 indicates that tile i is blue.
      An alternating group is defined as any 3 consecutive tiles in the circle where the middle tile has a different color from its adjacent tiles.
  
      Determine the number of alternating groups in the circle.
  
      Note that:
      because colors form a circle, the first and the last tiles are considered adjacent.
  
      Examples:
      >>> colors = [1,1,1]
      0
      >>> colors = [0,1,0,0,1]
      3
  
      Constraints:
      3 <= len(colors) <= 100
      0 <= colors[i] <= 1
      """
output:     
      n = len(colors)
      count = 0
      for i in range(n):
          if colors[i] != colors[(i + 1) % n] and colors[i] == colors[(i + 2) % n]:
              count += 1
      return count
  