[Question]
  [
## Introduction:
I think we've all heard of it, but here a very brief summary: Noah gathered two of every species of animal on the planet, male and female, to save in his Ark during a great flood. The actual quote from the Bible is:
> 
> *Genesis 7:2-3*  
> 
> You must take with you seven of every kind of clean animal, the male and its mate, two of every kind of unclean animal, the male and its mate, and also seven of every kind of bird in the sky, male and female, to preserve their offspring on the face of the earth.  
> 
> [source](https://www.biblegateway.com/passage/?search=gen+7%3A2-3&version=NET)
> 
> 
> 
But for the sake of this challenge we will ignore the clean/unclean part and the part where he took seven of each animal. This challenge is only about this part:
> 
> two of every kind of ~~unclean~~ animal, the male and its mate
> 
> 
> 
## Challenge:
**Input:**
You are given a list of positive integers (in random order).
**Output:**
Two distinct values indicating whether it's a 'List of Noah' or not. This doesn't necessary have to be a [truthy/falsey](https://codegolf.meta.stackexchange.com/a/2194/52210) value, so could also be `0`/`1` in Java/C#, or `'A'`/`'B'` in any language, to give some examples.
When is a list a 'List of Noah'? When there are exactly two of every integer in the list.
## Challenge rules:
* I/O is flexible. Input can be a list/array/stream of integers/floats/strings, or read one by one from STDIN. Output can be any two ***distinct*** values, returned from a function or output to STDOUT / a file.
* The integers in the input-list are in random order, and are guaranteed to be positive within the range \$1\leq n\leq100000\$.
* The input-list is guaranteed to be non-empty.
* Having an integer a multiple of two times present above 2 (i.e. 4, 6, 8, etc.) will be falsey. I.e. `[6,4,4,6,4,7,4,7]` is falsey, although you could still create equal pairs like this: `[[4,4],[4,4],[6,6],[7,7]]`.
## General rules:
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.  
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
* [Standard rules apply](https://codegolf.meta.stackexchange.com/questions/2419/default-for-code-golf-program-function-or-snippet/2422#2422) for your answer with [default I/O rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/), so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
* [Default Loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden.
* If possible, please add a link with a test for your code (i.e. [TIO](https://tio.run/#)).
* Also, adding an explanation for your answer is highly recommended.
## Test cases:
```
Truthy:
[7,13,9,2,10,2,4,10,7,13,4,9]
[1,2,3,1,2,3]
[10,100,1000,1,100,10,1000,1]
[123,123]
[8,22,57189,492,22,57188,8,492,57188,57189,1,1]
Falsey:
[6,4,4,6,4,7,4,7]
[2,2,2,2,2,2]
[5,1,4,5,1,1,4]
[77,31,5,31,80,77,5,8,8]
[1,2,3,2,1]
[44,4,4]
[500,30,1]
[1,2,1,1]
[2,4,6,4,4,4]
[2,23,34,4]
[2,23,3,3,34,4]
```
  
[Answer]
# [Python 3](https://docs.python.org/3/), 31 bytes
```
lambda l:{*map(l.count,l)}=={2}
```
[Try it online!](https://tio.run/##bVDNCoMwDL7vKXZTRxj2x7UKXvcEu80d3B8OahWnBxGf3aVWYR2j5MvPl6RJ6r4tKs2mZ5pNKi@v93yrkmFX5rWv9req0y2oYEzTgY5T3bx063unpmuLPvGCjQ08/bMAwiAGCiRE4EbNIQ7xJfjKI8gymNGNh1gyC8JiLp6bR7GaurUSKIVIEBkDj@nqSJCza21LE9ttKfUyfczV@@FucsCZORgURpyfsPn6nHiEnTkYRO0wQgAjyCBIPIlAEwf7cxL6syg3U7i9IrwGsweZPg "Python 3 ‚Äì Try It Online")
---
# [Python 2](https://docs.python.org/2/), 33 bytes
```
lambda l:set(map(l.count,l))=={2}
```
[Try it online!](https://tio.run/##ZVDNDoIwDL77FN6ApDGsDDdMuPoE3tTD/CGYDCQwD8b47LMbGFnM0q8/X9u17Z6mvrdoq/JgtWpOF7XUm@Fq4kZ1sV6d74/WgE6Ssnzh23b9rTXLaNc/TP3cRIvRr@K9AJZBAQgsJeBO@RCH4pj80hiRGXgMwikVeCGYzMkL0pBqMaiUgAi5YLIAXuDXkSC9O9ojzXyvqTI6tFulh2uww5qm5eBQOJl/Q52/bx7OqSsHh6TnhBCQMSIIJF1CkEkz/V8CwwW5GyBolNMNMn8G@wE "Python 2 ‚Äì Try It Online")
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 62 bytes (non-competing)
```
lambda x:{*[y.count(C)for C	in	(y:=x)]}!={*[2.]}##!2bcdfilmrtu
```
[Try it online!](https://tio.run/##TVHLboMwEDyHr9iQC6TbKDZQDBKnfAb1ITGgIBFA1JFAVb6drm0iVcjjnX2MZ8W46PvQR2KcVjVUNRTg@/732l0ft@oKc/57LJeTGp69Di5hM0xw2bX9LljyYg7la19QnZ/k63DY85uqmrZ7TPq5kkaZfzLp1XOtAr8p/A@jHnqekdDQ9lB6UKbIIsyQIzsTxOayqRgziVRnlI3QouNnarGHYAs35uqcurnrFcg5JikTGcYZfxOBwlIXuzLbpoepClQIxqEyDo1jiXAAfa8tgVb/1F1DrV9kMUaDqTl2nN54f5YnJByjQbptJk0xYpQhELRpSiH5@bcp35zERt3NJLRc5PaTuQfj1NKfaAIdIuhw/QM "Python 3.8 (pre-release) ‚Äì Try It Online")
Just for fun, a solution that is itself a "List of Noah".
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
¬¢<PŒò
```
[Try it online!](https://tio.run/##yy9OTMpM/f//0CKbgHMz/v@PNtcxNNax1DHSMTQAEiYgCixkomMZCwA "05AB1E ‚Äì Try It Online")
or as a [Test Suite](https://tio.run/##PU4xDsIwDNx5RdX5kGonxYmE6FIxs1cMIDEwMfAZZp7CA/hSOKctinz22WfnHs/L9X4rosdxaJvtoWmHsXze@9P3VVAmgwRkKKQjRE@1FZHPm0nYC6jorOO4BmEpF@ZTpVJdl6CK3iRlxKwrSUiVzvU8lrq5428RjubBDpfWR9ZTF@HITG6GIOSERLvGksf/drUejX7T1T39Bbf4Aw)
**Explanation**
```
¬¢      # count all occurrences of each element in the input list
 <     # decrement each
  P    # product
   Œò   # is equal to 1
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 4 bytes
```
·ªçt·µõ2
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//@Hu3pKHW2cDWdEWOkZGOqbmhhaWOiaWRjCOhY4FmAthQ6QNdQxjAQ "Brachylog ‚Äì Try It Online")
### Explanation
```
·ªç           Get the list of occurences of elements in the input: [[x,2], [y,2], ‚Ä¶]
  ·µõ         Verify that for each of those pairs‚Ä¶
 t          ‚Ä¶the tail (i.e. the number of occurences)
   2        ‚Ä¶is 2
```
[Answer]
# [R](https://www.r-project.org/), 20 bytes
-6 bytes thanks to digEmAll by changing the input method
```
any(table(scan())-2)
```
[Try it online!](https://tio.run/##VU/tCsMgDPy/p@hPhbTUaKfC9jBdWWEwHOwDOsae3Z1WC0NySc47Y@5xPs6vMD0vtyAW@XlMY2gObbNxXdfJJY7hLZ7j6XoWSSCkbFnG724Wk7CkNHliUj3ApJQpQ17KrFDgNWWsTA9ZDkApS1cVDAdXvSNmGqxynozn2jhyuV3r9VptL@zxA0MJbYrCwlxPYQZ4DCVELpy1pBU4gMM6FiWG/a3D2yCT5lTngB10XiP@AA "R ‚Äì Try It Online")
Outputs `FALSE` if it is a list of Noah, and `TRUE` otherwise. Works for any input type, not only integers.
Computes the count of each value in the list, and checks whether any of the counts are different from 2.
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~39~~, 32 bytes
```
l=>l.All(x=>l.Count(y=>y==x)==2)
```
Thanks to @Expired\_Data
[Try it online!](https://tio.run/##hVHBCsIwDL37FcXTBlFs19kO7UBEQfDuQTzoqDCoHeiGivjtM53upKuUvCTtSx5Js8sgu@T1srLZdLWw1Umf9wejp7ktUzgUhUnJkajaqNQMZ8YENxfMi8qWwV2ld6VuoVIsrCe9zTkv9Tq3OjgGVl@3O/IgAmgECTCgIwTuXHPFISHPMPxdRJEaQYMe0gibNYbwCT@Zp4hhX@bpKoExiAWVCfCEtYkE2aTv@P1Mv3X6/Y6uY5yXg0PhrFseFdvTTYpRm4ND9N00ISCiSEOQuHWBIc7xb@vMtz7uxvBIxrj9qP2A@gU "C# (Visual C# Interactive Compiler) ‚Äì Try It Online")
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 5 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
```
2¬®‚â°‚çß‚ç®
```
[Try it online!](https://tio.run/##hU4xDsIwDNx5BQ9wJeKkJJ1ZYEKifKBSC0sFDAwwIyGB1AoGHsAEG3/gKflIOaeFFUU@@3y2c9mmjPJ9Vq6XUbHbFqu8yJuG309/uvvq4atns/DHi69qX98mU38@vF/aH69g6WwEnI8nabPoW1KaEmJSA4CRFFqGkt4/VaGnKaCwAeQQgK7smKiMSZY5R8wUW@USMgl/iSMXaFu3sgqbQ/xmSNBKoIOl7wOLMWdIEFk8W9IKHOBg16LE8Z9dDkeN3JTpGP50Z1G0UHH3Id4H "APL (Dyalog Extended) ‚Äì Try It Online")
Is it true that‚Ä¶
‚ÄÉ`2¬®`‚ÄÉtwo for each element
‚ÄÉ`‚â°`‚ÄÉis identical to
‚ÄÉ`‚çß‚ç®`‚ÄÉthe count-in selfie (count of own elements in self)
?
[Answer]
# [Haskell](https://www.haskell.org/), 33 bytes
```
f x=and[sum[1|b<-x,b==a]==2|a<-x]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P02hwjYxLyW6uDQ32rAmyUa3QifJ1jYx1tbWqCYRyIv9n5uYmWdbUJSZV6KSFm2oY6hjBIRAOvY/AA "Haskell ‚Äì Try It Online")
For each element of the input we ensure it appears twice in the input list.
`sum[1|b<-x,b==a]` is just a golfier version of `length(filter(==a)x)`.
[Answer]
# [Perl 6](http://perl6.org/), 18 bytes
```
{so.Bag{*}.all==2}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/ujhfzykxvVqrVi8xJ8fW1qj2f3FipYKSSryCrZ1CdZqCSnytkkJafpGCjaGdDpBQgFEKRnAGkPkfAA "Perl 6 ‚Äì Try It Online")
* `.Bag` converts the input list to a `Bag`--a set with multiplicity.
* `{*}` extracts all of the multiplicities.
* `.all` creates an and-junction of the multiplicities.
* `== 2` results in another and-junction of Booleans, each true if the multiplicity is 2.
* `so` collapses the junction to a single Boolean.
[Answer]
# [J](http://jsoftware.com/), 10 bytes
```
[:*/2=#/.~
```
[Try it online!](https://tio.run/##VU/LDsIgELz3KyZ6IBJtYQGhTXoy8eTJq0djY7z4B/46LrRQDeywM7vs4xU3rZgwDhDYQ2FgO7Q4XS/neBtkR@O2az9x16B53J9vTPDQBj0IWjHY9GTJoi8pmgNmxiopvtkYFndhNYVMskIDiOC8Dj1sT4UE1hOd/TmsSw0hpRTl/5Enshl9siLTeorkuILNyG9d08NoFhmCSsxx5/C/Ia3D29Ssfna8l/ldLaUyjV8 "J ‚Äì Try It Online")
[Answer]
# JavaScript (ES6), 37 bytes
Returns *false* for Noah or *true* for non-Noah.
```
a=>a.some(v=>a.map(x=>t-=v==x,t=2)|t)
```
[Try it online!](https://tio.run/##dVDLDsIgELz7Iy3JaoRSoRp69Au8qQeirY/UYiw2mvjvdWltog2GMLvLLLMwZ13ranc7Xe24NPusyVWjVaonlblkYe2yi76GD5XasaqVeoBVjLwsaXamrEyRTQpzCIPV7W6Pz3lAFqPv8zxcC6ARJMCAThG4C@0Rh2RLyLCbYk8ELfrYKV5vN8In/VS@boZKzKcjgTGIBZUJ8IT1hQTZll3e0bRT/hEINuVSF1XmvjtUnuG/ODgUbntm47h@edgYJ3JwiNHDCwERRR5BopECU3z2XyOZ1xju3uhTj9HJqDOzeQM "JavaScript (Node.js) ‚Äì Try It Online")
### Commented
```
a =>               // a[] = input
  a.some(v =>      // for each value v in a[]:
    a.map(x =>     //   for each value x in a[]:
      t -= v == x, //     decrement t if v is equal to x
                   //     (i.e. if v appears exactly twice, t is decremented twice)
      t = 2        //     start with t = 2
    )              //   end of map()
    | t            //   yield t, which is supposed to be equal to 0
  )                // end of some()
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 8 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous tacit prefix function. Returns `0`/`1`.
```
‚àß/2=‚ä¢‚àò‚â¢‚å∏
```
[Try it online!](https://tio.run/##PU49iwJBDO39JQoRd7Kzzmxx1TV3FgqunVgIgo2grSxXHRx7iys2gpWFFjb@AH9P/sj6Mn4w5CUvecm86WrRnq2ni@W8rqW4dPhDypMUB/k/yeZW57Ldy9@uKdWWpfwFy4afwNHXd9ZC7mWDvlTHH6nOeQS81mNHJqaUmEwEsJpCy1I6aYwNejEFVBZhHALwLJ9Mpwwlq84TMyXO@JRsyi/iyQf6qB9jEza7@M2SotNAB0uvB5ZAZ0kRGdw5ig04wMOuQ4njb7scjlq9qeoE/mK1eAc "APL (Dyalog Unicode) ‚Äì Try It Online")
‚Ä¶`‚å∏`‚ÄÉfor each value as left argument and indices of occurrences of that value as right argument, call:
‚ÄÉ`‚â¢`‚ÄÉtally the right argument (the occurrences)  
‚ÄÉ`‚àò`‚ÄÉthen  
‚ÄÉ`‚ä¢`‚ÄÉreturn that, ignoring the left argument
‚ÄÉ`2=`‚ÄÉBoolean list indicating which tallies are 2
‚ÄÉ`‚àß/`‚ÄÉAND-reduction (i.e. are they all true?)
[Answer]
# [MS SQL Server 2017](https://docs.microsoft.com/en-us/sql/sql-server/sql-server-technical-documentation?view=sql-server-2017), ~~152~~ ~~150~~ 146 bytes
```
CREATE FUNCTION f(@ NVARCHAR(MAX))RETURNS
TABLE RETURN SELECT IIF(2=ALL(SELECT
COUNT(*)FROM STRING_SPLIT(@,',')GROUP BY
PARSE(value AS INT)),1,0)r
```
The readable version:
```
CREATE FUNCTION f(@ NVARCHAR(MAX)) RETURNS TABLE RETURN
  SELECT IIF(2 = ALL(SELECT COUNT(*)
                     FROM STRING_SPLIT(@, ',')
                     GROUP BY PARSE(value AS INT)), 1, 0) AS r
```
Try it on [SQL Fiddle](http://sqlfiddle.com/#!18/dfcbb/1)!
*-2 bytes thanks to Kevin Cruijssen*
[Answer]
# [Haskell](https://www.haskell.org/), ~~61~~ 45 bytes
```
import Data.List
all((2==).length).group.sort
```
[Try it online!](https://tio.run/##PU67DoMwDNz7FRk6gGQhEkITBraO/QPEkIG2qOEhSL@fngNUkc8@39nx262fzvtt64d5WoK4u@CyR7@Gy7N23ieJqus08934Cu80ey3Td85WGLfB9aOoxbz0YxBXMbhZPEXTGJIFVaRI5gDNKbY0VS01Er2CIjLLIccAHOXBWFVwKvZZUopKI21FulInsWQj3etdlnHyht80MRoOdDB0PrASPk2MyODGUCHBARbnGpRY/j9XxaWad7K7xH3FcSJrqNrtBw "Haskell ‚Äì Try It Online")
Thanks to @KevinCruijssen for 12 bytes, and @nimi for another 4.
First Haskell answer, but it was surprisingly easy to do. Can ~~probably~~ be golfed a lot. *Case in point...*
[Answer]
## TI-Basic, 47 Bytes
```
Input(L1
SortA(L1
not(remainder(dim(L1,2)) and prod(not(‚ñ≥List(L1))=seq(remainder(I,2),I,1,-1+dim(L1
```
I am a big of fan of TI-Basic. It's not a great language for really any purpose, but I enjoy programming (and golfing) in it.
How does this code work?
First, it sorts the list.
Second, it uses the ‚ñ≥List function to generate another list, which is the difference between elements of the sorted list. (For example, ‚ñ≥List({1,3,7,8}) would yield {2,4,1}). Applies not to this list, which converts every non-zero element of the list to zero and every zero to one.
Then, the program checks that the resultant list fits the pattern `{1, 0, 1, 0, ...}`, which will only be true if the original list is a Noah list.
There is also an additional check that the length of the list is even, to catch some edge cases.
Here are some screenshots of test cases:
[![Some test cases](https://i.stack.imgur.com/t3zku.png)](https://i.stack.imgur.com/t3zku.png)
[![Some more test cases](https://i.stack.imgur.com/vtvML.png)](https://i.stack.imgur.com/vtvML.png)
[Answer]
# [Julia](https://julialang.org/), ~~30 characters~~ 26 bytes
```
!a=all(x->2==sum(a.==x),a)
```
Thank you, H.PWiz for this trick!
[Try it online!](https://tio.run/##VU5JDsIwDLz3FXAr0lARJyXpIf1IxSEXJFBBiEXqgQfwBN7HR4rtpkIoysQzHsdzfPSHZIZxH8dliqnvy2HdUoy3x6lMVYzDCmk1dkXnYSwaEMyGwcmjkkOzQ9EZFi0UlW7YoJchl5lpm9hL6gwgQu1NaOAamklAUDrVU9vobNFteaeDoJcrn/DcfITW7HUQ5FcE72ENCwyBc3suecMvN02xnHysAzUntXNYaU8l5cXZxess7B9BFordonq2i8v1cL7358/rvR@/)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
Q≈ì^∆ë
```
[Try it online!](https://tio.run/##RU6xDQIxDOwzyxUfJyHJGJQoejoa9AvQ0lAj1mALBIOwSDg7/0KRz77z2fH5tCyX3vfvx/Fz76/b9/o89N5cy/ABFQI/EaImkyLqDNc8xQBDoxMNFoS1XJm1hV4xZ4EIUvalIlbZSEExOurR9mN2xy8jFLOGShzbntJEa4Qiswo5I3gKhMKzM0t@8D9bxuaoi20g8dCgt7r5Bw "Jelly ‚Äì Try It Online")
```
Q       Is the list of unique elements
   ∆ë    unchanged by
 ≈ì^     symmetric multiset difference with the whole input?
```
In broader terms, "if you remove each unique element once, do you have one of each left?" This is guaranteed to stay in the right order because `≈ì^` is implemented as equivalent to `≈ì-≈ì|≈ì-@`, `Q≈ì-` is just empty, and `≈ì-` [specifically removes elements last-first](https://github.com/DennisMitchell/jellylanguage/blob/70c9fd93ab009c05dc396f8cc091f72b212fb188/jelly/interpreter.py#L644) while `Q` is in the order of first appearances.
[Answer]
# [VDM-SL](https://raw.githubusercontent.com/overturetool/documentation/master/documentation/VDM10LangMan/VDM10_lang_man.pdf), 64 bytes
```
f(a)==forall y in set inds a&card{x|x in set inds a&a(x)=a(y)}=2
```
---
### Explanation
VDM works predominantly like second order logic statements.
```
forall y in set inds a                //Bind y to each of the indices of a
{x|x in set inds a&a(x)=a(y)}         //build a set of the indices of a who have the same
                                      //value as the value at y
card {...} = 2                        //and check the cardinality of that set is 2
```
---
### Since you can't TIO VDM here's output from a debug session
[![](https://i.stack.imgur.com/BzTC2.png)](https://i.stack.imgur.com/BzTC2.png)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~66~~ ~~37~~ 26 bytes
-11 bytes thanks to mazzy
```
!(($args|group|% c*t)-ne2)
```
[Try it online!](https://tio.run/##dU/RboMwDHzPVzCVLrC5UmNCEx72LVM1hbYTKhW0WqXSb2fnANrTFPnssx37fGl/QtcfQ9OMaf3xGF@yLN13h344dO3tMqyTr7drvjkHzsenUqtrdwsqc2QKqojJbAFWXExZqnJSmUGyoIiRbtEQDTCHM4tlRi/HTk/MVDrjK7IVL8STj3SKpzLm5MP6oV/TOtHv6efmuz2ddaKHU7g/ldZqVe@bHlJ3EGVJ0InJFgxentASwywJwkvCOSoMEgCPwxxCSPg7jCfdVgbHDyVOKZZrpDyFPC@Wrn@1jr8 "PowerShell ‚Äì Try It Online")
Groups up `$l` and grabs all the counts of matching values. It then filters out all counts of 2 from this list. If the list is empty, it's a Noah number; otherwise, it'll be populated still with non-2 counts. Not-ing the list will yield `True` if it's empty and `False` if it's populated
[Answer]
# [Elixir](https://elixir-lang.org/), 52 bytes
```
fn v->Enum.all?v,fn x->2==Enum.count v,&x==&1end end
```
[Try it online!](https://tio.run/##dVDLDoIwELz7FZyMJiuhS7HlUD158OQHGA9GISHBahQIf4/TihepaXb2Mdvpdou66qvnUJqhtFG32uxse4vPdb3tCIV@tWFjfO1yb20TdTTvjZmLwl4j2LA/xJV9PYpLE5Xx4qhIpJQTk0gA0jlfkpSflrOfZoGWlDwGyASXvQHGcMwCzQwdDqhoYqZMCZ2TzPmbaNI@/cQfWnjd3/trTC7JoXI2fQCa3zMlM6hKcgg/pZWiVIAGaOxJIcRk//bEoY9LN15AOsOe0vCqnFCI4PGjXm94Aw "Elixir ‚Äì Try It Online")
Complete Elixir noob here :-D.
[Answer]
# [PHP](https://php.net/), 60 bytes
```
function($a){return!array_diff(array_count_values($a),[2]);}
```
[Try it online!](https://tio.run/##RVHRaoQwEHz3K7big8LCXaJXFXv0Q6xI8BK8ckSJsVCO@3a7iZESMpndzGZndR7n7eNzHucoSqxc7AJXaCOAtkSWY40c2ZmgcIdPFVh3CHA6gTWrdEpG9zl67NAnzqT2myDQEAUBJz0P6go5x0vJqhqLmh9BhZUPd75fM1/vat7JRoEOS7fJEPlR4rF4Q/TIsfYWFyot0CGde6osMWeUIqhospIotQz2/ED8cFu4XqHsQkPk/3M40RHw4Mhpo66h76nguqlVD/Y@6TQR2dNIuxr9JowRv/3trlS602Fate1/xGOVixNiy7useW30iJqMFMOYQvg7YiEGGTyppRzGCb6XSfdSD9NNponNEOIv61aMkKgjo@Mmem1/ "PHP ‚Äì Try It Online")
PHP has great built-ins for this, though at 20 chars, `array_count_values()` is not a very golfy one.
[Answer]
## Mathematica, ~~25~~ 24 bytes
```
MatchQ[{{_,2}..}]@*Tally
```
[Try it online!](https://tio.run/##RU7BCsIwDL33KzxLmGva2e4g7AcEBW8iUoZjg82D7CKl3z6TdENKX/KSl@RNYe5fU5iHNizd7rScw9z213uMT8BUFOnR7G9hHL/L5TO852bfHZqoogNtoAYEXRJYDlKyUCdQUVPRgKDQkgTyCdZ0ZdJG0qIoPSBC5bSvwda4EQ9eaM5zW8usike6aYHR8eclNLc9phVpLTBS5IJzYDQVCDz5dpTShb9vzLYsL5aBipyazSy3c4rrYVaptPwA)
The `Tally` function returns a list of the form `{{*element*, *count*}, ...}`, which is then matched against a pattern that checks whether all *count* are 2.
[Answer]
# [Attache](https://github.com/ConorOBrien-Foxx/Attache), 16 bytes
```
${All&x!{_~x=2}}
```
[Try it online!](https://tio.run/##VU/BCsIwDL3vKyYMTznYrLOdIEO8iwdvY8jQToUhYisoMn99pt26aUtf816TNK80pjycVVuFi2UbvVd1PX1O3vvPc4lN026UOuo8ut0OpyLY3i9Xs1ParEutdF5BmAchrSwLzf1hzi/HcgEshhQQ2IyA28tJHNICuhRGDzE4HKQZJbpD0Ic9G1KQanCokIAIiWAyBZ6iJxKko13cPTPXw89albVW/axzmoqDRWGPb03d/PZSQl04WKTbi0JAzEgkkORSUEj//7vE0QC3nw3FCXmLf@3Z1JFiP5itCIqi/QI "Attache ‚Äì Try It Online")
## Explanation
```
${All&x!{_~x=2}}
${             }    lambda with input x
  All&x!{     }     over each element _ of x:
         _~x            check that the number of occurrences of _ in x
            =2          is 2
```
## Alternatives
**17 bytes:** `{All&_!`=&2@`~&_}`
**18 bytes:** `{All[`=&2@`~&_,_]}`
**23 bytes:** `Same@2&`'@Sum@Table[`=]`
**25 bytes:** `Same¬´2'Sum@Table[`=,_]¬ª`
**25 bytes:** `Same<~2'Sum@Table[`=,_]~>`
**25 bytes:** `{Same[2'Sum@Table[`=,_]]}`
**35 bytes:** `{Commonest@_==Unique@_and _[0]~_=2}`
[Answer]
# [Octave](https://www.gnu.org/software/octave/) / MATLAB, ~~22~~ 21 bytes
```
@(x)any(sum(x==x')-2)
```
Anonymous function that inputs a numeric vector, and outputs `0` if the vector satisfies the condition or `1` otherwise.
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0IzMa9So7g0V6PC1rZCXVPXSPN/mka0uY6hsY6ljpGOoQGQMAFRYCETHctYzf8A) Or [verify all test cases](https://tio.run/##RVDLCoMwELz7FbnVwFZMjE2kBPofUoqInqw9qMVS@u12NmpL2NmdfQ551GP1bJbWJ0myXOJZVv0rHqZ7PHs/H@RRy2VshvFWV0MzCC/epSWVUUGaVAow7ELKUHEVpUIuo4DMUpSDAbZwY1zV6NTc50hryq1yBZlC78SRC3SN17LiSWiNyhMuGmK0bNiCwf2B5eg1xAgPbi1lChzgINkixIGfZB0kGd7J3Tk0Zizzc47qpuvaqY9bEv@/kMsX).
### Explanation
```
@(x)                   % define anonymous function with input x
            x          % x
               x'      % x transposed and conjugated
             ==        % equality comparison, element-wise with broadcast. Gives a
                       % square matrix
        sum(     )     % sum of each column
                  -2   % subtract 2, element-wise
    any(            )  % true if and only if any value is not zero
```
[Answer]
# [Julia 1.0](http://julialang.org/), 32 bytes
```
l->sum(isone,l./l')/length(l)==2
```
[Try it online!](https://tio.run/##hZHNTsMwDMfvfYpol7WS2ZqPkvRQxIkn2A1xGCLtikKQlkSCpy9OP4QqltIqjlP/bNf/vAfTn@nXEFxvO3LSzmdtM5i7Bxc@8t59Wg3mcDT74mi07fwlN0XTsOHRI@m0J7vTNfjL94686q63GcFnjJE2f5ZAOdTAgJZoRNzGTwLql4I0DfHXoNcpFEEOo00iJRYaF5rZnU/JFIY1WbKiAsagklTVIGq2HBSo8Tj5U5iuemj7lv0K8XQ2Tt8W4h5HFhCtjGsq0UZ@zWHv5U0yFf6EgGhxT1JSAqdIoVGoukQX50nik@xsme4GIeIE6X4Vys/LjfzYgW7E2SzQVhOUhQP/n4C/FF7V8AM "Julia 1.0 ‚Äì Try It Online")
Divides each element of the input array `l` by the transpose `l'` giving a matrix. Summing over this matrix while applying `isone` to each element gives twice the length of `l` if each element appears exactly twice.
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), 9 bytes
**Solution:**
```
&/2=#:'.=
```
[Try it online!](https://tio.run/##y9bNz/7/X03fyFbZSl3P1lzB0FjBUsFIwdAASJiAKLCQiYLl//8A "K (oK) ‚Äì Try It Online")
**Explanation:**
```
&/2=#:'.= / the solution
        = / group
       .  / value
    #:'   / count (length of) each
  2=      / equal to 2?
&/        / take minimum
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 17 bytes
```
2==##&@@Counts@#&
```
[Try it online!](https://tio.run/##VU7LCsIwELz3NwI9rdhsUpMcKgF/wLt4KGKxh1bQeCr99ribpIiEzO7Mzj6mPjzuUx/GWx@HLmLXCVF7f3p@5vD2oo7n1ziHi9gdBy@u9d4v1WJAKnCAIBsCzSFJGtwK1SJJVJAw0YYM6ROUtLBURvJiclpAhNZI60A73IgFm2jOc1nm3gOt1MBo@LNEbdtj2pJVAyNFFowBJUkgsHS2oZQW/M7GPFnz4NTQ0qFqu5XLOcWyuLhonQL1R6AI1Rq/ "Wolfram Language (Mathematica) ‚Äì Try It Online")
`Counts` returns an association of `<| *(value)*->*(# occurences)*, ... |>`. Then `2==##&` checks if those occurence-counts are all equal to 2.
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata) + `-e`, 4 bytes
```
oƒâ≈§ƒë
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TVA7DsIwDBUrp6gyu1LzKUnOUnUoqCwIOrQcgpGZpUMRDByjXILT8JykCEV5fs9-sa3cnqf20B2boXlVIj8KykTeinq8n4d97h7dfHlP83Xqt7s-5cbPKqssSU2eFMkCYDiElCFfryuJnKaArAqUwwUkmhRXFZyKfY6UotJK58l4tQhHLsjIY1mGlxtMM8Ro-SKDR8uBKuEzxIgIbS1pCQ1wWNeCovlvXRWaGu7J7hL76bQi1wJTaWC0YIwm_c8p6fhTXw)
```
oƒâ≈§ƒë
o       Sort
 ƒâ      Split into runs of equal elements
  ≈§     Transpose; fails if not rectangular
   ƒë    Check if length is 2
```
---
# [Nekomata](https://github.com/AlephAlpha/Nekomata) + `-e`, 4 bytes
```
oƒ≠u=
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TVAxDsIwDBQrr6gyuxJxUpIMvKTqUFBZUOnQ9jUsHajEAL_gFbyGc5oiFOV8Z19sK7fHtbl0bT3Uz1LlraJM5Y2qpnkczrmfu_drPNz746lPmemzyUpH2lAgJr0DWAkxZSlU21IjZyiiqB3K8QISTUqqDCeLzxMzFU77QDbwKjz5KBe-lHV8ucc0S4JOLjJ4tB6oAj5LgojQzpHR0ACPdR0omv_W5djUSk9xF9jPpBWlFhmngYsFYwyZf05JLz_1BQ)
```
oƒ≠u=
o       Sort
 ƒ≠      Uninterleave
  u     Uniquify
   =    Check equality
```
---
# [Nekomata](https://github.com/AlephAlpha/Nekomata) + `-e`, 4 bytes
```
≈¢‚â°2=
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TVAxDsIwDBQrr6gyu1LjpCQdeEnVoaCyoMLQ8gjewFIQCAa-wScYeQnnNEUoyvnOvthWTo9ds923dV8_S5W2ihKVNqoabod-k_r76_I5nnl57VbrLuaG9ywpHWlDBTHpDGAlhJSlopqXGjlDAUVlKIcLiDQqqTKcLD5PzJQ77QuyBU_Ckw9y5GNZh5cLTLMk6OQig0fTgcrhsySICO0cGQ0N8FjXgaL5b10OTa30FHeO_UxcUWqBcRw4WjDGkPnnFPX4U18)
```
≈¢‚â°2=
≈¢       Tally; produces a list of unique elements and a list of their counts
 ‚â°      Check if all counts are equal, and return that value
  2=    Check if equal to 2
```
[Answer]
# Elm 0.19, 66 bytes
```
n a=List.all(\x->List.foldl(\y c->if x==y then c+1 else c)0 a==2)a
```
Verify all test cases [here](https://ellie-app.com/62XcGPK4CGna1).
For every item, iterate over the list and count how many items it is equal to. Return `True` if the count is exactly 2 for each item, `False` otherwise.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 7 bytes
```
!n#2/LQ
```
[Try it online!](https://tio.run/##K6gsyfj/XzFP2UjfJ/D//2gzHRMgBJHmIBwLAA "Pyth ‚Äì Try It Online")
```
!n#2/LQQ   Implicit: Q=eval(input())
           Trailing Q inferred
     L Q   For each element of Q...
    / Q    ... count its occurrences in Q
  #        Filter keep those elements...
 n 2       ... which are not equal to 2
!          NOT - maps [] to True, others to False
           Implicit print
```
]