[Question]
  [
Given an array of numbers with `length >=3` and `length % 3 == 0`
`[1, 2, 3, 4, ...]` 
You will split it in sub-arrays of length 3
`[[1, 2, 3], [4, 5, ...], [...` 
And return an array with
* [0] => The amount of cases in the sub-array where **all numbers are equal**
* [1] => In case all numbers in sub-array are not equal, the amount of cases in the sub-array where **only 2 numbers are equal**
**Example and test cases:**
* Input: `[2, 4, 2, 5, 5, 5, 4, 2, 1, 3, 3, 1]` output `[1, 2]`
This is because 
```
[[2, 4, 2], [5, 5, 5], [4, 2, 1], [3, 3, 1]]
  ^     ^    ^  ^  ^               ^  ^ 
   equal    all equal              equal   
```
so 2 `equal` and 1 `all equal`
* `[3,5,6,5,5,7,6,6,8,7,7,7,3,4,2,4,4,3] => [1, 3]`
* `[3,3,3,4,4,4,5,5,5,6,6,6,5,4,3] => [4, 0]`
* `[3,4,5,6,7,8,9,8,7,6,5,4,3,2,1] => [0, 0]`
---
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in bytes win.
---
PD: Apologies for my English.
  
[Answer]
# [Octave](https://www.gnu.org/software/octave/), ~~60~~ ~~52~~ 50 bytes
```
@(x)sum(sum(~diff(sort(reshape(x,3,[]))))'==[2 1])
```
[Try it online!](https://tio.run/##ZY7NCsIwEITvPsVexASW0vy1eoj4HiGHog16kEpbpSdfPW7SKoo7DLOH/ZjtjmPzaGOwRVHEA5v4cL@y5OfpEgIbun5kfTucm1vLJlToPKfZWOskCM9jYE6hwYpssKascEuZpFCjJGtUngPAGsDuwQkE5VeZU/kmyWRVWeZDzLNwGqFcOJ1va2ra5baFoTbxz5VvTuZ/5qa0idz/Tfxw9Kf08QU "Octave – Try It Online")
Saved 8 bytes thanks to Luis!
### Explanation:
Reshapes the input into a matrix with 3 rows, and the appropriate amount of columns. It then sorts each of the columns, and calculates the difference between the elements on different rows. This gives a matrix with two rows, where identical numbers will have a zero, and different numbers will have a positive number. This is negated, so that all equal elements are `1`, and all unequal are `0`. We then sum each of those columns, giving us one of the three alternatives: `0 = All elements are unequal`, `1 = Two elements are equal` and `2 = All elements are equal`. We then check how many are `>1`, and how many are exactly `==1`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~9~~ 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
-1 thanks to Dennis (use a new alias for `L€`, `Ẉ`)
```
Q3ÐƤẈċⱮ2
```
**[Try it online!](https://tio.run/##y0rNyan8/z/Q@PCEY0se7uo40v1o4zqj////RxvrmOiY6pjpmOtY6FgCsTmQbQoUM9Yx0jGMBQA "Jelly – Try It Online")**
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
```
3ôεÙg}12S¢
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f@PCWc1sPz0yvNTQKPrTo//9oYx1THTMgNtUxB9JmOhZAGgSNdUx0jIDYRMc4FgA "05AB1E – Try It Online")
**Explanation**
```
3ô          # split input into groups of 3
  ε  }      # for each triple
   Ù        # remove duplicates
    g       # and get the length
      12S¢  # count the number of 1s and 2s in the result
```
[Answer]
# JavaScript (ES6), 70 bytes
```
f=([a,b,c,...d],t=p=0)=>1/a?f(d,t+!(a-b&&a-c?b-c||++p:b-c&&++p)):[t,p]
```
[Try it online!](https://tio.run/##bY1BDoIwFET3ngI3TRs@BWwBJUEOQliUAkZDaCPEFXevbdWF0T@ZzCz@y9zEQyzyftVrNKt@MGascCOgAwmU0r6FtdJVQqpzGot6xD2s4R6LqENIRLLuIrltYahLWxCyhZCyWUG3Rqp5UdNAJ3XBI24YZJBbZ1DYzOFo04kBh4M1B9YSEsRx0KQQsHb3wzP/65R55V7Zh3yd4zkEyR@ee6awyye//mbtevrNJ443Tw "JavaScript (Node.js) – Try It Online")
### How?
We recursively extract each triplet **[a,b,c]** from the input array and update two counters **t** (three-of-a-kind) and **p** (pair), using the following formula:
```
t =
t + !(a - b && a - c ? b - c || ++p : b - c && ++p)
```
There are 5 possible cases which are detailed below, from 'all equal' to 'all distinct'.
```
a b c | a-b && a-c | b-c | b-c || ++p | b-c && ++p | t +=
------+------------+-----+------------+------------+------------
4 4 4 | false      | 0   | n/a        | 0          | !0    --> 1
4 4 5 | false      | ≠0  | n/a        | ++p        | !++p  --> 0
4 5 4 | false      | ≠0  | n/a        | ++p        | !++p  --> 0
5 4 4 | true       | 0   | ++p        | n/a        | !++p  --> 0
4 5 6 | true       | ≠0  | ≠0         | n/a        | !(≠0) --> 0
```
[Answer]
# Pyth, ~~13~~ ~~14~~ ~~12~~ 11 bytes
```
/Lml{kcQ3S2
```
[Try it here](http://pyth.herokuapp.com/?code=%2FLml%7BkcQ3S2&input=%5B3%2C4%2C5%2C6%2C7%2C8%2C9%2C8%2C7%2C6%2C5%2C4%2C3%2C2%2C1%5D&debug=0)
### Explanation
```
/Lml{kcQ3S2
      cQ3        Split the input into groups of 3.
  ml{k           Deduplicate and get the length of each.
/L               Count the number...
         S2      ... of 1s and 2s.
```
[Answer]
# [oK](https://github.com/johnearnest/ok), ~~17~~ 16 bytes
```
+/(1 2=#=:)'0N3#
```
[Try it online!](https://tio.run/##LY09DoAgDIV3TtGEAYgxCi2gJFzBY7AweP8JSyXf8Nr3@tP3t4/RynZYD6HqWpw5H9SjGRuAIEAUZuUBGa@Q@yRuZk1wsU5QpohBhTJLwn8hCXGlJE7m3Vv2VzK/uPEB "K (oK) – Try It Online")
```
            0N3# /reshape into groups of 3 (see ngn's comment)
  (       )'     /for each group:
        =:       /    make a map from number -> indices
       #         /    count number of keys/values
   1 2=          /    check if the count is equal to 1 or 2 
+/               /sum together the columns
```
For [k](https://en.wikipedia.org/wiki/K_(programming_language)), the 17 byte version is: `+/(1 2=#=:)'0N 3#`.
[Answer]
# [R](https://www.r-project.org/), 70 bytes
```
function(v,x=lengths(by(v,seq(0,a=v)%/%3,table)))c(sum(x<2),sum(x==2))
```
[Try it online!](https://tio.run/##dVBBTsQwDDyTV/iyii0ZAU3bBWnDJzgCh2zVLpVKCk12tQjx9uJYHODAjKxJ5LEnyrIOfh2OscvjHPHEZz/18ZBfEu4/5Jr6d7zm4E@0udo4zmE/9UTUYTq@4nlXEevB@4pozX3KCXaXMI0powHBBSg6dNxwK9XwVrTlW9FCxzVXUjU7YgN/UKacOgobZats/vXX6tnK/jvN@PFKxg2RGeYFA4wR9Kn0WRZ0IaN9tJznh7yM8YCB2D5btuDvQeR3a5Bm6T5FK1/z5q0l86XZZv0G "R – Try It Online")
***Previous versions :***
# [R](https://www.r-project.org/), 82 bytes
```
function(v,a=!1:2){for(i in lengths(by(v,seq(0,a=v)%/%3,table)))a[i]=a[i]+1;a[-3]}
```
[Try it online!](https://tio.run/##dVDLTsMwEDzjr1gOlb1iK0idpOVhfoJjyMGNktZS5JTYVEJVvz2sLQ5wYEbrOcx41@t5GcwyfPouusmrM1lzWzxt8DJMs3LgPIy9P8RjUPsvdkP/oR44c8bV/UpTtPuxR0TbuNak4654ts1at9cl9iEGeFnD6EJUAhg3kNEpTRXVXBVtWWvasSZqKmnDVZJGEvAH6ZbOicQqs86s/s2XObPl/o95xk@WZxSIIm1o04b5qXhJDToblWwkxektzs4flEWSrSQJ5hVYflsDm8l995L/5WSkRHHNs8XyDQ "R – Try It Online")
---
# [R](https://www.r-project.org/), 93 bytes
```
function(v,a=table(lengths(by(v,0:(length(v)-1)%/%3,unique)))[c('1','2')])`[<-`(a,is.na(a),0)
```
[Try it online!](https://tio.run/##dU/LasMwEDxXX6FL0C6s0zh@pA1xf6JHNxDFyInAyK0lB0rpt7srkUN76AzLIO1oRzstfbP0s@uCHR3cSDdBnwcDg3GXcPVw/uTLzf5@hhtmOa4eVwXNzn7MBhHbDlSuSG0VHvHUHrITaLJ@7TRopA0uwfjg5SGTg/UBhGQ8yIQOCqqo5qpox1rTE2tkQSVtuUoqkIT8g/iqSI7IKrFOrP71l8mz4/nPKePu5YwcUfTjBFpaJ9NX8SsO6HQA1SoK42uYrLvEZdSR95TNi2T53eq5GbtvTpE3741SKL5Ttlh@AA "R – Try It Online")
[Answer]
# [Java (JDK 10)](http://jdk.java.net/), 116 bytes
```
l->{int r[]={0,0,0},i=0,a,b,c;for(;i<l.length;b=l[i++],c=l[i++],r[a==b?b==c?0:1:b==c|a==c?1:2]++)a=l[i++];return r;}
```
[Try it online!](https://tio.run/##bVFRT4MwEH7fr7gsWQLuJGOMqWBdfPHNpz0SHgrC7OyAtMeSZfLbZynMGDXX9nr9Pq7fR/f8yG/3bx8XcWhqRbA3tdeSkN5NPPlzVrZVTqKu/gU1qYIfeiiXXGt45aKC8wSgaTMpctDEyaRjLd7gYDBnS0pUuyQFrnbatVSAl/GKR1FRkqJdn6BkF3n7dDYVqCRl5wWa6FCwBXLMMI/LWjmxeJSeLKodvccZk4mYz1PMrxuVcMayTcZYvllEftRvPnlf@dEync9dPjJjVVCrKlBxd4mtJivC6KRCkwY2KgU4LxFWCGYNr2MofYTADr/DKzfAENdmhnhn8hrvTe4jwBUuzVxh8JMcWKCP0MbaRvibtrLQnen2YDuOFNPR7yyrGyyY/wOO9WFdRIMX99vKAKlCt5KMw9LjTSNPTs9y45GzPWkqDl7dkteYl6PSmc50BDM9q6YIz0rxk/aoHp51@PTv8XCFOzbtNXaT7vIF "Java (JDK 10) – Try It Online")
Note: returns a 3-elements array with `[0]` and `[1]` returning th appropriate values, and `[2]` returning a dummy value (the number of 3-lists without any elements in common) . This is totally valid according to the current rules.
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 106 bytes
```
param($a)for(;$a){$x,$y,$z,$a=$a;if($x-eq$y-and$y-eq$z){$i++}else{$j+=$x-eq$y-or$y-eq$z-or$z-eq$x}}+$i,+$j
```
[Try it online!](https://tio.run/##NYpBCsIwFEQv8xcpmS601iql4FU@mGJKNDVdmKbk7PEXdDEzj@HN/mPC8jDOlTJz4KcirkYfVC@7UQStoATigbi3o6JYmzetNb/u0oJJLKt1Nm4xG016@Bs@/ISd0k4xZ00WmqZSyk01OKHFGR0uuEo64Va@Bkccqi8 "PowerShell – Try It Online")
Exactly what it says on the tin. Loops over input `$a`. Each iteration, peels off `$x,$y,$z` as the next three elements. Tests `if` they're all equal and if so, increments `$i`. `Else`, increments `$j` if at least one pair is equal. Once the loop is complete, output `$i` and `$j` as integers.
*So ... many ... dollars ...*
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 68 bytes
```
(.+)¶(.+)¶(.+)
;$1;$2;$3;$1;
%M`(;\d+)(?=\1;)
s`((1)|(3)|.)+
$#3 $#2
```
[Try it online!](https://tio.run/##K0otycxL/K@qEZwQ46L9X0NPW/PQNgTJZa1iaK1iZK1iDGJwqfomaFjHpGhratjbxhhaa3IVJ2hoGGrWaBhr1uhpanOpKBsrqCgb/f9vpGOiY6RjCoYglqGOMRAachkD@WZgUXMgbaZjAaRB0BisygQIjbmMwWpNwBBighkYmkJlTcAi5kC9lmD9UBmQLQA "Retina 0.8.2 – Try It Online") Link includes test cases with header to convert to desired format of one value per line. Explanation:
```
(.+)¶(.+)¶(.+)
;$1;$2;$3;$1;
```
Collect three values onto each line with separators and duplicate the first one at the end.
```
%M`(;\d+)(?=\1;)
```
Count the number of pairs of duplicates.
```
s`((1)|(3)|.)+
$#3 $#2
```
Count the number of `3`s and `1`s.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 8 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
íUÖ←#"ë╕
```
[Run and debug it](https://staxlang.xyz/#p=a155991b232289b8&i=[3,5,6,5,5,7,6,6,8,7,7,7,3,4,2,4,4,3]%0A[3,3,3,4,4,4,5,5,5,6,6,6,5,4,3]%0A[3,4,5,6,7,8,9,8,7,6,5,4,3,2,1]&a=1&m=2)
[Answer]
# Common Lisp, 113 bytes
```
(lambda(l &aux(a 0)(b 0))(loop for(x y z)on l by #'cdddr do(if(= x y z)(incf a)(if(/= x y z)()(incf b))))`(,a,b))
```
[Try it online!](https://tio.run/##PY9NCsJADIX3nuKhqAkI/kytutCzmHYoFGqn1BbURa9eM7E4D5LwJbxk8qp8NiNVITQoQouybvpOI9ZEByQ44GiK1R5OtecZOSWp8ZPmFGfNUc7mEpVjxDFnKOpnk5qONhD7ibGTGlzMZOrFZczwAaRHPaRDh/kgwPUGDDIs59OhpKfLI/NCFVbSv0iwY8o08P9P9MIbHw41KmRvLNa5975VcyoLuuLXpbLOCwhHtv3DCWes704b2Wg12mYF4xc)
Used the fact that in Common Lisp `(= x y z)` gives true if all the three elements are equal, and `(/= x y z)` gives true if no pair of numbers is equal. 
[Answer]
# Japt, ~~14~~ 13 bytes
```
2õ@ò3 x_â Ê¶X
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=MvVA8jMgeF/iIMq2WA==&input=WzIsIDQsIDIsIDUsIDUsIDUsIDQsIDIsIDEsIDMsIDMsIDFdCi1R)
---
## Explanation
```
2õ                :Range [1,2]
  @               :Pass each X through a function
   ò3             :  Split input to arrays of length 3
       _          :  Pass each through a function
        â         :    Remove duplicates
          Ê       :    Get length
           ¶X     :    Test for equality with X
      x           :  Reduce by addition
```
[Answer]
# [Haskell](https://www.haskell.org/), 90 bytes
```
g[]=[]
g(a:b:c:x)=(sum$map fromEnum[a==b,a==c,b==c]):g x
f x=[sum[1|y<-g x,y==n]|n<-[3,1]]
```
[Try it online!](https://tio.run/##dUzBDoIwDL3zFT14wKQcxhgocUe/YtlhoCCRDQOSQMK/Y516MdrXvqbt67uY4Xpu23WtlZZKB3Vo8iIv82krw2G0G2tuUPWdPbrRKiNlgUQlFkR6m9cwBRVMUpFUsWU@RLTBWUqnF3eIFEem9WpN40DCqQuA4tY37g4bqEDFCAkCsfjka2QI3CfT3y8cBaZUAjPqKe6oP8ExwZgqQf7jh/v7E8Ij9RB/1IlXZOS99/5vJfkzvT4A "Haskell – Try It Online")
Looks a bit awkward...
[Answer]
# [Python 2](https://docs.python.org/2/), ~~77~~ ~~72~~ 65 bytes
```
lambda a:map([len(set(t))for t in zip(*[iter(a)]*3)].count,(1,2))
```
[Try it online!](https://tio.run/##RY7RCsIwDEWf9Sv6tlaC0HbddDB/pPah6oaFrSuzPujP17QKcgkJNzeHhFe8L16ksT@nyc6XmyW2m22geho8fQyRRsbGZSWROE/eLtCddnFYqWVmJ5nZX5enj0A5CMZSDtoc1FqCggZLQYu9gQP2LAk1CKwapAGCMVmsLFXUFKl/oC5mi4RjofyWSOEGtCi872meeAFyY7rtJqzOR2Kh6k8VjPhy@gA "Python 2 – Try It Online")
7 bytes saved via a clever trick from [xnor](https://codegolf.stackexchange.com/users/20260/xnor)
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 23 bytes
```
S2,3,` 
%Cq`\S+
*\C`1
2
```
[Try it online!](https://tio.run/##K0otycxLNPyvp6p0aNuhbUp2Gu4J/4ONdIx1EhS4VJ0LE2KCtbm0YpwTDLmM/v83UjBRMFIwBUMQy1DBGAgNuYyBfDOwqDmQNlOwANIgaAxWZQKExlzGYLUmYAgxwQwMTaGyJmARc6BeS7B@qAzIFgA "Retina – Try It Online")
### Explanation
```
S2,3,` 
```
Split the input at every 3rd space starting at the (0-based) 2nd, i.e. split the input into groups of three.
```
%Cq`\S+
```
On each line (`%`) count the number (`C`) of unique (`q`) values (`\S+`).
```
*\C`1
```
Count the number of `1`s and print them with a trailing linefeed (`\`), but do so in a dry-run (`*`) so that we don't lose the previous result.
```
2
```
Count the number of `2`s (and print them automatically).
[Answer]
# [J](http://jsoftware.com/), 16 15 bytes
-1 byte thanks to cole!
```
1#.1 2=/_3#@=\]
```
[Try it online!](https://tio.run/##RY3BCoNADETv@xWDHkSQrWvWtQoL/ZCWHoqLePHg2W/fJrFFHiFhZpisOe3RosWENrvSOnTx9qbyEZ@vXJvCokrRVmhwTEi7MfNn2ZDQwfP0ilwOxLi/TSwHNQfeAXfeAmnYM4QrS6oLZ2FQpJiukFdj4KpR634B@Z2/ "J – Try It Online")
Pretty much the same approach as the majority of solutions.
## Explanation:
```
        _3    \]  - split the input into sublists of lenght 3
          #@~.    - for each triplet remove duplicates and take the length 
   1 2=/          - compare with 1 and 2
1#.               - add up
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 49 bytes
Saved two bytes thanks to Martin Ender.
```
{#~Count~{_},#~Count~{_,_}}&@BlockMap[Union,#,3]&
```
[Try it online!](https://tio.run/##RY3NCsIwEIRfZSHQ04q06Y8elKJnwYunEEooFoM2FYmnkL56TLZC@Q6zzAyzo7KP@6is7lUY4ADBsfk8fY2dXedxvbHzPmtPr6l/XtRb3IyeDDLkMgvXjzZWMNgcYRBMSshg24JzBZZYYEWkK0ceyT2C49GqKWii1riLmuBULCN8qXGyEstOTVRroSSziQt7WvmH6Z334Qc "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Elixir](https://elixir-lang.org/), 92 bytes
```
fn a->import Enum;c=map chunk(a,3),&(length uniq&1);{count(c,&(&1==1)),count(c,&(&1==2))}end
```
First, chunks the list into size length 3 `chunk(a,3)`
Secondly, it converts finds the length of each element, uniqified; `map chunk(a,3),&(length uniq&1)`. 
Finally, it returns an array consisting of the number of times the resulting list is equal to one `count(c,&(&1==1))` and the number of times the resulting list is equal to two `count(c,&(&1==2))`.
[Try it online!](https://tio.run/##VY3NCoJAFIX3PsXFhcyFSRitVYybaNGqB4iQYZx0SK82jhGYz25WtAg@DpwfOKa2D@vmUTnHIZ9Awq4tTGzuqs577yyV7HCMS@N7FoaIwbILnhmw@UKgVpltutZ52NPQbLVsVAe6GujKFE@RR6w2VPoKBrK3SOB21O1AnumliYSUApH/JwniZKiYMWb4vlmuLfWd0Z7hfEo4rDksuvnxtYJD@kGcXw "Elixir – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 59 bytes
```
->a{[1,2].map{|x|a.each_slice(3).count{|y|x==y.uniq.size}}}
```
[Try it online!](https://tio.run/##VY3NCsIwEITvPoVHhRhItj96iC8SgsSQYkHbai00Jn32mKyCyHeYZWaYfUxnFxsRd0ftJSNc0ZsefJiDplaby2m8tsZuYEtNP3VPH1yYhXB06to7HduXXZYlDutGSk4KwkmJ5IsRSDClVhhDsisM66QV2SfNAJaLBPyqgHbms1ch5X@pwKBOSwdc@xbya6XiGw "Ruby – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~24~~ 19 bytes
```
ò3 ®â l
[Uè¥1 Uè¥2]
```
[Try it online!](https://tio.run/##y0osKPn///AmY4VD6w4vUsjhig49vOLQUkMFMGUU@/9/tLEOCJqAoSkYmoGhKZBvHKugAAA "Japt – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 14 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ü┬─*HTÜ╫\Ä╢qm♥
```
[Run and debug it](https://staxlang.xyz/#p=81c2c42a48549ad75c8eb6716d03&i=[2,+4,+2,+5,+5,+5,+4,+2,+1,+3,+3,+1]%0A[3,5,6,5,5,7,6,6,8,7,7,7,3,4,2,4,4,3]%0A[1,1,1]&m=2)
[Answer]
# [Prolog (SWI)](http://www.swi-prolog.org), 80 bytes
```
[A,B,C|T]-X/Y:-T-M/N,(A=B,B=C,X is M+1,Y=N;X=M,(A\=B,B\=C,Y=N;Y is N+1)).
_-0/0.
```
[Try it online!](https://tio.run/##hU7LCoMwELz3K3KsuGu0MdoHoRjPevKgqPRUiiC1aMFL/z3dpD0WyjAs7Mzs7GOexumGyzoY02agIX9VPda8OWKFBS9hmykNWuVQs2FhhR9Bo8pTrQpSOit1pNlVY/XSjzwv2Fww5GFgzshaARISooSUZgJ7mhYCYtgRYxA9ZlwDW@fheR3vW/tGT0c@aeGcFtIhcZB/c7HzptR3cJ3fDHVGv3PmDQ "Prolog (SWI) – Try It Online")
[Answer]
# [Factor](https://factorcode.org/) + `pair-rocket`, 58 bytes
```
[ 3 group 1 => 2 [ '[ cardinality _ = ] count ] with map ]
```
[Try it online!](https://tio.run/##XVDBSgMxEL3vV7ybJwtttlu11Kt48SKelkVCTNuwNYmTWWQp/fZ1dlQQ80he8t5jwszeOk40vTw/Pj3c4UBpyCEeUDwX7GnEu@XjorDlUDi4AltKEgoJvafoT5L8GHx0viCTZx4zhcjINtA1Jdd7xraqzhVknbFCLXutmG9LGMESlx/fiN6ouxFucCM8w2i6Fpg/WaP6jO@KjWL9L1Wrs5Fat1rvN7HSfy/V1MpDGxdhdy96i6sWztJbiPYUeMQrdujg0iCddfgMfJS5ZHTTfMpwXL@YvgA "Factor – Try It Online")
[Answer]
# Desmos, 84 bytes
```
l(r)=r.length
b=[l(k[3x-2...3x].unique)forx=[1...l(k)/3]]
f(k)=[l(b[b=1]),l(b[b=2])]
```
[Try it on Desmos!](https://www.desmos.com/calculator/gc3b94ydvy)
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) ~~14~~ 13 bytes
```
3ẇƛ∪L;:1O$2Ox
```
[Try it online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCIz4bqHxpviiKpMOzoxTyQyT1csIiwiIiwiMSwxLDEsMiwzLDQsMSwxLDEsMiwyLDEiXQ==)
#### Explanation:
```
3ẇ             # 3-partition
  ƛ            # Open lambda map
   ∪L          # Length of sublist union
     ;         # Close lambda map
      :        # Duplicate for next operation
       1O      # Count 1
         $     # Swap
          2O   # Count 2
            x  # Print stack as list
```
[Answer]
# C (GCC), ~~135~~ ~~128~~ 117 bytes
*-7 bytes thanks to [@ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)*
*-11 more, again thanks to [@ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)*
This is basically [@ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)'s answer now, since he's improved it by more than 13 percent.
```
#define E(k)v[k-~i]==v[i
a;b;i;f(v,l)int*v;{for(a=b=i=0;i<l;i+=3)E()]&E(1)]?++a:E()]|E(1)]|E(1)+1]&&++b;*v=a;v[1]=b;}
```
[Try It Online!](https://tio.run/##VU/RTsMwDHzvV0RDVMniiZVuAy1EiId@RclDmiXIWkhhjCBRyq@XdEwq2LJPZ/nOslk8GTMMFzvrMFhS0T2L9X7xjUrKWGOmRSNQOBrBMwzHeRSdaw9Uy0aiXAq88wK5LFlFmcorWjB1z7nejvTrRE@dFyrPOW/EPEotYl0o2Yh@eNYYKMu6jJwjXSDRmloRSboS1rBJtYabhBu4TThmCSu4TrWCshf/pN6GJHzDT9u60Ydc/SH1Uk3b6SFrYBSwafhySCaOzh68J/b1XfstudwBOX60E30MMzi7/WKhkkM//AA)
Unfortunately, I'm too lazy to write a new explanation for the most recent answer, but it's quite similar to the previous 128-byte one:
```
#define E(j,k)v[j+i]==v[k-~i]
a;b;i;f(v,l)int*v;{for(a=b=i=0;i<l;i+=3)E(,)&&E(,1)&&++a||(E(,)||E(,1)||E(1,1))&&++b;*v=a;v[1]=b;}
```
[Try It Online!](https://tio.run/##VY/RTsMgFIbv@xRkxgXWs7jabRqRCy/2FMgF7cCwIdU5MbGtr14P25Iq5PDl/If/J9Tzl7oehqutsS4YsqE72LMod7lTQkS5n/84lWleccctjeCZC8dZ5K1tDlSLSjix4O7Rc5eLkm0osOkUzwKR57rraJK67iQlFMjTrOKzKDSPslCi4v3wql2gLGszcln4DommlooI0pawgjXWCu6Qa7hHpl3CEm6xllD2/J/Vm4DGD/dtGptyyM2fRi7UeBu/ZWpIBjaKbwcMsXTy5D0x75/aP5DrLZDjVzO2z2ECl7QzC4UJ/fAL)
`f` takes a vector (`v`) and its length (`l`) as arguments, and return its values in the first two elements of that vector. Explanation:
```
#define E(j,k)v[j+i]==v[k-~i] // k-~i == k-(-i-1) == k+i+1. an empty first argument equals +i, and an empty second argument equals -~i == i+1
a;b;i;
f(v,l)int*v;
{
    for(a=b=i=0;i<l;i+=3)
        E(,)&&E(,1)&&++a // if element i, i+1 and i+2 are all equal, increment a
        ||(E(,)||E(,1)||E(1,1))&&++b; // otherwise, if any two elements are equal, increment b
    *v=a; // set the first element in v to a
    v[1]=b; // set the second one to b
}
```
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), 9 bytes
```
.,2,`?.`/3@,`$$@
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWG_R0jHQS7PUS9I0ddBJUVBwgwlDZm5rRStHGOqY6ZkBsqmMOpM10LIA0CBrrmAD1mgChcaxSLFQHAA)
## Explanation
```
.    Map
,2    [1,2]
,     length of
`?     find indices in
.       map
`/ 3     split into chunks of 3
@         input
,        length of
`$        deduplicate
$          the chunk
@       of the number (1 or 2)
```
[Answer]
# [Elm](https://elm-lang.org/), ~~108~~ 106 bytes
```
import List.Extra as E
m=List.map
f x=m(\j->E.count((==)j)<|m(List.length<<E.unique)<|E.groupsOf 3 x)[1,2]
```
[Try it on Ellie](https://ellie-app.com/kR8yPsRw22Ha1)
[Answer]
# [Raku](https://raku.org/), 30 bytes
```
(+«*.rotor(3)».Set).Bag{1,2}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtfQ/vQai29ovyS/CINY81Du/WCU0s09ZwS06sNdYxq/1srFCdWKiipxCvY2ilUpymoxNcqKaTlFynYGCmYKBgpmIIhiGWoYAyEhnY6CjbGQCEzsIQ5kDZTsADSIGgMVmgChMYQZcZgIRCEmGMGhqYIBSZgQXOgCZZgU6CSIOvs/gMA "Perl 6 – Try It Online")
* `*.rotor(3)` breaks up the input list into groups of three elements.
* `».Set` converts each of those groups into a `Set`.
* `+«` converts each of those sets into its size.
* `.Bag` makes a `Bag` (a set with multiplicity) out of those sizes.
* `{1, 2}` looks up in that `Bag` the number of times sets with sizes of 1 and 2 were present.
]