f a@(h:t) = (r1 && (f (a \\ [h,h,h]))) || (r2 && (f (a \\ [h,h+1,h+2])))
  where
    nh = length $ filter (== h) a
    r1 = nh >= 3
    r2 = (elem (h+1) a) && (elem (h+2) a)
f a@(h:t) = (r1 && (f (a \\ [h,h,h]))) || (r2 && (f (a \\ [h,h+1,h+2])))
  where
    nh = length $ filter (== h) a
    r1 = nh >= 3
    r2 = (elem (h+1) a) && (elem (h+2) a)
f a@(h:t) = (r1 && (f (a \\ [h,h,h]))) || (r2 && (f (a \\ [h,h+1,h+2])))
  where
    nh = length $ filter (== h) a
    r1 = nh >= 3
    r2 = (elem (h+1) a) && (elem (h+2) a)