input: from typing import List
  
  def count_alternating_triplets(colors: List[int]) -> int:
      """
      Imagine a circular arrangement of red and blue tiles. You are provided with an array of integers called colors, where each colors[i] represents the color of the ith tile:
  
      colors[i] == 0 indicates the tile is red.
      colors[i] == 1 indicates the tile is blue.
      A sequence of 3 consecutive tiles in the circle where the middle tile differs in color from its adjacent tiles is known as an alternating triplet.
  
      Return the total number of such alternating triplets.
  
      Note:
      Since colors represent a circle, the first and last tiles are considered adjacent to each other.
  
      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+1) % n]:
              count += 1
      return count
  