[Question]
  [
In [this question](https://codereview.stackexchange.com/q/245978/105327) at Code Review they tried to find the fastest way to return the unique element in an array where all the elements are the same except one. But what is the shortest code that accomplish the same thing?
### Goal
Find the unique element in an array and return it.
### Rules
* The input array will contain only integer, strictly positive numbers, so you can use 0 as the end of the input if your language needs it.
* The size of the array will be at least 3 and will have a finite size. You can limit the size of the array to any limit your language has.
* Every element in the array will be the same, except for one which will be different.
* You must output the value (not the position) of the unique element in any standard format. You can output leading or trailing spaces or newlines.
* You can take the input array in any accepted format.
### Examples
```
Input                   Output
------------------------------
[ 1, 1, 1, 2, 1, 1 ]      2
[ 3, 5, 5, 5, 5 ]         3
[ 9, 2, 9, 9, 9, 9, 9 ]   2
[ 4, 4, 4, 6 ]            6
[ 5, 8, 8 ]               5
[ 8, 5, 8 ]               5
[ 8, 8, 5 ]               5
```
### Winner
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so may the shortest code for each language win!
  
[Answer]
# [Python 3](https://docs.python.org/3/), 27 bytes
```
lambda x:min(x,key=x.count)
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaHCKjczT6NCJzu10rZCLzm/NK9E839BUWZeiUaaRrShjgIEGUEYsZqaXHBJYx0FUzhCkbEEa7BERijyJjoKEGSGImwBNsoCJPYfAA "Python 3 ‚Äì Try It Online")
[Answer]
# [R](https://www.r-project.org/), 24 bytes
```
a=scan();a[a!=median(a)]
```
[Try it online!](https://tio.run/##K/r/P9G2ODkxT0PTOjE6UdE2NzUlE8hL1Iz9b6gAgkYg8j8A "R ‚Äì Try It Online")
[Answer]
# JavaScript (ES6), ~~¬†32¬†~~ 27 bytes
*Saved 5 bytes thanks to @xnor*
```
a=>a.sort()[0]+a.pop()-a[1]
```
[Try it online!](https://tio.run/##dc5NCoMwEIbhvaeYZUJjrL/owl4kZDFYLYo4wYjXTyG1QSqFdzGLh4@ZcEfbraPZ4oWevRtah@0DpaV1Y1zd9Q2lIcN4jCrVrqPF0tzLmV5sYApScZR9DtAAwDkkCWTRL84FlCEvA84vuPGbzTnQ/5YLcVR9Z8NydcG1f6A@yYBL9wY "JavaScript (Node.js) ‚Äì Try It Online")
### How?
`a.sort()` sorts the input array in lexicographical order. We know for sure that this is going to put the unique element either at the first or the last position, but we don't know which one:
```
[ x, ..., y, ..., x ].sort() -> [ y, x, ..., x ] or [ x, x, ..., y ]
```
Either way, the sum of the first and the last elements minus the 2nd one gives the expected result:
```
[ y, x, ..., x ] -> y + x - x = y
[ x, x, ..., y ] -> x + y - x = y
```
We could also XOR all of them:
```
a=>a.sort()[0]^a.pop()^a[1]
```
[Try it online!](https://tio.run/##dc5BCoMwEIXhvaeYZQJprFpFF/YiIcJgtVQkE4x4/RRSG6RS@Bez@HjMhBu6fnnZ9WLoMfix9djeUTpaVsbVVXcoLVnGO1SZ9j0ZR/MgZ3qykSnIxF7@OUADAOeQppAnv7gQUMaCjLg44SZsNsdA/1u@ib3qOxuXqxOuwwP1QUZc@jc "JavaScript (Node.js) ‚Äì Try It Online")
[Answer]
# x86-16 machine code, 14 bytes
**Binary:**
```
00000000: 498d 7c01 f3a6 e305 4ea6 7401 4ec3       I.|.....N.t.N.
```
**Listing:**
```
49          DEC  CX             ; only do length-1 compares 
8D 7C 01    LEA  DI, [SI+1]     ; DI pointer to next value 
F3 A6       REPE CMPSB          ; while( [SI++] == [DI++] );
E3 05       JCXZ DONE           ; if end of array, result is second value
4E          DEC  SI             ; SI back to first value
A6          CMPSB               ; [SI++] == [DI++]? 
74 01       JE   DONE           ; if so, result is second value
4E          DEC  SI             ; otherwise, result is first value 
        DONE: 
C3          RET                 ; return to caller 
```
Callable function, input array in `[SI]`, length in `CX`. Result in `[SI]`.
**Explanation:**
Loop through the array until two different adjacent values are found. Compare the first to the third value. If they are the same, the "odd value out" must be the second, otherwise it is the first.
*Example:*
Input `[ 1, 1, 1, 2, 1, 1 ]`, reduce until different adjacent values are found `a = [ 1, 2, 1, 1 ]`. If `a[0] == a[2]` then result is `a[1]`, otherwise result is `a[0]`.
**Tests using DOS DEBUG:**
[![enter image description here](https://i.stack.imgur.com/X1ee5.png)](https://i.stack.imgur.com/X1ee5.png)
[![enter image description here](https://i.stack.imgur.com/VpQ5P.png)](https://i.stack.imgur.com/VpQ5P.png)
[![enter image description here](https://i.stack.imgur.com/YkjXd.png)](https://i.stack.imgur.com/YkjXd.png)
[![enter image description here](https://i.stack.imgur.com/8Hu9y.png)](https://i.stack.imgur.com/8Hu9y.png)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
 í¬¢
```
[Try it online!](https://tio.run/##yy9OTMpM/f//1KRDi/7/jzbUUTDSUQCShrEA "05AB1E ‚Äì Try It Online")
Since `1` is the only truthy integer in 05AB1E, we can just filter (`í`) on the `¬¢`ount.
There is also the Counter-Mode builtin, which returns the least frequent element in a list at the same bytecount:
```
.m
```
[Try it online!](https://tio.run/##yy9OTMpM/f9fL/f//2hDHQUIMoIwYgE "05AB1E ‚Äì Try It Online")
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 5 bytes
```
‚ç∏1=¬Ø‚ç∏
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//1HvDkPbQ@uB1P@0R20THvX2PepqPrTe@FHbxEd9U4ODnIFkiIdn8P80BUMwNAKRXGkKxgqmEAhkWwJFLWEQyDcBQzMgywKowgIA "APL (Dyalog Extended) ‚Äì Try It Online")
Regular Dyalog APL 18.0 has `‚ç∏‚ç£¬Ø1`, but it doesn't work here because it requires the input array to be sorted, unlike Extended's `¬Ø‚ç∏` which allows unsorted input arrays.
### How it works
```
‚ç∏1=¬Ø‚ç∏  ‚çù Input: a vector N of positive integers
       ‚çù (Example: 4 4 6 4)
   ¬Ø‚ç∏  ‚çù Whence; generate a vector V where V[i] is the count of i in N
       ‚çù (¬Ø‚ç∏ 4 4 6 4 ‚Üí 0 0 0 3 0 1)
 1=    ‚çù Keep 1s intact and change anything else to zero (V1)
       ‚çù (1= 0 0 0 3 0 1 ‚Üí 0 0 0 0 0 1)
‚ç∏      ‚çù Where; generate a vector W from V1, where i appears V1[i] times in W
       ‚çù (‚ç∏ 0 0 0 0 0 1 ‚Üí 6)
```
[Answer]
# [Haskell](https://www.haskell.org/), 32 bytes
```
f(x:y)|[e]<-filter(/=x)y=e|1<3=x
```
[Try it online!](https://tio.run/##hc7RCoMgFAbg@z3FuTTQjXJFjXyEPUHI8EKZzCJaFwW9uxN1Q6@m/4VwPn/OU7xf0hhrFdpue3EMkvdEabPKBV3YVuxMHmVP2WZHoSdgMIr5/gA0L3pa4QyqOAEM7pY4pgoP4OAPIVA5gh2hGOpfvvNAaCSd/9@l8TBpueKYJqkIpInE9bcu@TyQOpLWb/GPtPmiGeH2Aw "Haskell ‚Äì Try It Online")
# Explanation
The code, expanded with variables renamed to be more descriptive.
```
f (first:rest)
 | [unique] <- filter (/=first) rest = unique
 | 1 < 3 = first
```
`(first:rest)` is a pattern match on a list that destructures it into its first element (`first`) and the list without the first element (`rest`).
Each line with a `|` at the front is a case in the function (known as "guards" in Haskell). The syntax looks like `functionName args | condition1 = result1 | condition2 = result2 ...`. There are two cases:
1. `[unique] <- filter (/=first) rest`. This asserts that `filter (/=first) rest` produces a list containing only one element, which we name `unique`. `filter (/=first) rest` filters out all elements in `rest` not equal to `first`. If we are in this case, then we know that `unique` is the unique element, and we return it.
2. `1 < 3`. This asserts that 1 is less than 3. Since it's always true, this is a "fallthrough" case. If we reach it, we know that there are at least 2 elements not equal to the first element, so we return `first`.
[Answer]
# [Bash](https://www.gnu.org/software/bash/) + coreutils, 12 bytes
```
sort|uniq -u
```
[Try it online!](https://tio.run/##S0oszvj/vzi/qKSmNC@zUEG39P9/Qy4YNILQAA "Bash ‚Äì Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
·∏ü√Ü·πÉ
```
Explanation: `·∏ü` (probably) removes all elements that are not the most common element (returned by `√Ü·πÉ`). I don't know why isn't the result a single-element list (perhaps it's a feature I didn't know about?), but that makes this even better.
[Try it online!](https://tio.run/##y0rNyan8///hjvmH2x7ubP7//3@0iQ4ImsUCAA "Jelly ‚Äì Try It Online")
[Answer]
# [J](http://jsoftware.com/), 10 8 bytes
```
1#.|//.~
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DZX1avT19er@a/7nSlMw1IEiIwhDAShmrKNgCkcKIAAUtAQrsURGIGETHSgyA/EswHosFAA "J ‚Äì Try It Online")
### How it works
```
 1#.|//.~  input:                  1 1 1 2 1
      /.~  group by itself:        1 1 1 1
                                   2
    |/     insert | (remainder) into both groups:        
                   1 | 1 | 1 | 1 = 0
                   2             = 2
 1#.       sum:                    2
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 17 bytes
```
@(x)x(x!=mode(x))
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0KzQqNC0TY3PyUVyNb8n6YRrWCoA0VGEIZCrCYXSNxYR8EUjmCClmBllsgIJmWiA0VmMBELsF4LIPc/AA "Octave ‚Äì Try It Online")
2 bytes golfed thanks to [Luis Mendo](https://codegolf.stackexchange.com/a/207749/67312)!
[Answer]
# [Ruby](https://www.ruby-lang.org/), 18 bytes
```
->a{a-[a.sort[1]]}
```
[Try it online!](https://tio.run/##TYu7CoNAEEV7v@IiLBgYBTURLfRHhikmothl8VGI@u0ruCKBU9znuHxX19cubnTTmDWZfuPMqcjhmJHSTeYFhAJGTvg8@Ki6JtU/vnjTTeF9eb1KiCSdtgM27LrDLvMUhcaibmBsCANWQs8q8sLhTg "Ruby ‚Äì Try It Online")
The unique element will always be the largest or smallest, so remove all copies of the second element.
[Answer]
# [Octave](https://www.gnu.org/software/octave/) / MATLAB, 19 bytes
```
@(x)x(sum(x==x')<2)
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0KzQqO4NFejwta2Ql3Txkjzf5pGtIKhDhQZQRgKsZpcIHFjHQVTOIIJWoKVWSIjmJSJDhSZwUQswHotgNz/AA "Octave ‚Äì Try It Online")
### How it works
```
@(x)                  % Define a function of x
          x==x'       % Square matrix of all pairwise comparisons (non-complex x)
      sum(     )      % Sum of each column
                <2    % Less than 2? This will be true for only one column
    x(            )   % Take that entry from x
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~21~~ ~~19~~ 17 bytes
```
f[c=a_...,b_,c]=b
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78/z8tOtk2MV5PT08nKV4nOdY26X9AUWZeSbSyrl2ag4NyrFpdcHJiXl01V7WhDggagchaHa5qYx1TCARxLIHiljAIEjDRAUEzENMCqMiilqv2PwA "Wolfram Language (Mathematica) ‚Äì Try It Online")
[Answer]
# [R](https://www.r-project.org/), 25 bytes
```
a=sort(scan());a[a!=a[2]]
```
[Try it online!](https://tio.run/##K/r/P9G2OL@oRKM4OTFPQ1PTOjE6UdE2MdooNva/sYIpCP4HAA "R ‚Äì Try It Online")
Sort the input, giving `a`. Now `a[2]` is one of the repeated values. Keep only the element not equal to `a[2]`.
This ends up 4 bytes shorter than my best shot with a contingency table:
```
names(which(table(scan())<2))
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 4 bytes
-1 byte thanks to @FryAmTheEggman
```
ho/Q
```
[Try it online!](https://tio.run/##K6gsyfj/PyNfP/D//2gFCx0FUx0FC4VYAA "Pyth ‚Äì Try It Online")
## Explanation
```
 o   : Order implicit input
  /Q : by count of the element
h    : then take the first element
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 23 bytes
```
$args-ne($args|sort)[1]
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfmvkmZb/V8lsSi9WDcvVQPMqCnOLyrRjDaM/V/LxaVSklpcomCroMGloWCoA0VGEIaCpo4CGCgbAWWNdRRM4QguBZI1BspagnVZIiOIGrBeEx0oMkPWCJI1A8oCDbQAIjQpkKwpUNYCbCNIFsKxAFvPpQl1e41qNZdKFdAHKvFcaippCg5VXLX/AQ "PowerShell ‚Äì Try It Online")
Takes input by splatting. We apply a filter to the original array getting rid of the dupes by sorting it and taking the 2nd element.
[Answer]
# T-SQL, 40 bytes
Input is a table variable
```
DECLARE @ table(v int)
INSERT @ values(1),(1),(2),(1)
SELECT*FROM @ 
GROUP BY v
HAVING SUM(1)=1
```
Another variation
# T-SQL, 54 bytes
```
DECLARE @ table(v real)
INSERT @ values(1),(1),(2),(1)
SELECT iif(max(v)+min(v)<avg(v)*2,min(v),max(v))FROM @
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 4 bytes
```
o·∏Ö‚àã‚â†
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/P//hjtZHHd2POhf8/x9tomOiY6xjEvs/CgA "Brachylog ‚Äì Try It Online")
Takes a list and returns a singleton list.
## Explanation
```
o·∏Ö‚àã‚â†  Input is a list, say [4,4,3,4].
o     Sort: [3,4,4,4]
 ·∏Ö    Blocks of equal elements: [[3],[4,4,4]]
  ‚àã   Pick a block: [3]
   ‚â†  This block must have distinct elements (in this case, must have just one).
      Output it implicitly.
```
[Answer]
# [RAD](https://bitbucket.org/zacharyjtaylor/rad), 13 bytes
```
‚çµ[1‚ç≥‚ç®+/‚çµ‚àò=¬®‚çµ]
```
The lack of a need for `{}` in this language really helps.
[Try it online!](https://tio.run/##K0pM@f//Ue/WaMNHvZsf9a7Q1gdyHnXMsD20AsiI/f//v6ECBBoBAA "RAD ‚Äì Try It Online")
## Explanation
```
‚çµ[1‚ç≥‚ç®+/‚çµ‚àò=¬®‚çµ]
     +/‚çµ‚àò=¬®‚çµ  count of each element's # of occurrences
  1‚ç≥‚ç®         first occurrence of a 1
‚çµ[          ] the argument at that index
```
[Answer]
# [Haskell](https://www.haskell.org/), 30 bytes
```
f(x:y)|elem x y=f$y++[x]|1>0=x
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P02jwqpSsyY1JzVXoUKh0jZNpVJbO7oitsbQzsC24n9uYmaegq1CbmKBb7yCRkFRZl6Jgp5CmiaXgkI0EBrqQJERhKEQqwAGuroKRkAlOkAlxjoKpnAEk4coMYYqsQTrt0RGYIVIppjoQJEZkhEQJWZQJUDzLYAIVR6ixBSqxALsCkJKLFAdiqIk9j8A "Haskell ‚Äì Try It Online") Footer stolen from [coles answer](https://codegolf.stackexchange.com/a/207784/64121).
If the first element is not in the remaining list, return it, otherwise rotate it to the end and try again.
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k), ~~8~~ 6 bytes
**Solution:**
```
*<#'=:
```
[Try it online!](https://tio.run/##y9bNS8/7n2alZaOsbmv1P01dw1ABBI1ApLWxgikEWlsCRSxh0FrBBAzNrE0VLBQsrC2ASkAkkNb8/x8A "K (ngn/k) ‚Äì Try It Online")
**Explanation:**
```
*<#'=: / the solution
    =: / group the input
  #'   / count length of each
 <     / sort ascending
*      / take the first
```
**Extra:**
* **-2 bytes** thanks to `ngn` by dropping the lambda
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 19 bytes
```
Tr[#/.Median@#->0]&
```
Inspired by [Kirill L.'s R submission](https://codegolf.stackexchange.com/a/207747/86341)
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7P6QoWllfzzc1JTMxz0FZ184gVu1/cHJiXnRAUWZeSbSygq6dQlq0cmysmo5CdbWhDggagchaIN9YxxQCQRxLoLglDIIETHRA0AzENNWx0LEAMSyAqqEMILO2NvY/AA "Wolfram Language (Mathematica) ‚Äì Try It Online")
Finds the median, replaces its occurrences in the list with 0, and sums the list.
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~3~~ 2 bytes
*-1 byte thanks to [Razetime](https://codegolf.stackexchange.com/users/80214)!*
```
‚óÑ=
```
[Try it online!](https://tio.run/##yygtzv7//9H0Ftv///9HG@uYQmAsAA "Husk ‚Äì Try It Online")
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 3 bytes
```
ƒä‚Üìh
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=%C4%8A%E2%86%93h&inputs=%5B9%2C%202%2C%209%2C%209%2C%209%2C%209%2C%209%5D&header=&footer=)
## Explained
```
ƒä‚Üìh
ƒä     # Get the counts of all items
 ‚Üì    # Get the smallest item based on last item
  h   # Output the head of that list
```
Also, according to code-golf's statistics, only a small percentage of people who view my answers actually upvote them. So if you enjoy this answer, consider upvoting, it's free, and you can change your mind at any time (given you have ‚â•2k rep). Enjoy the answer.
[Answer]
# [Julia 1.0](http://julialang.org/), 24 bytes
```
~d=d[@.sum(==(d),[d])<2]
```
[Try it online!](https://tio.run/##fY7LCsMgEEX3fsUsFaQQ0wQDFfIfgwuDLaT0ATGBrvLr1o5BQha9nMXA8c54Xx6jqz4xrt547E9heXJjuBcSvRUXZaM3yDhCJTdUHsBKoCjx07WEplBcSk26o163Jz/K7bPcaPfVlJZ02qkTB5fSkNZ09Z/Wh08VbRnD3oVwnWZYnTE4WLi9J@BODgLGF3gbvw "Julia 1.0 ‚Äì Try It Online")
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 2 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md "Thunno 2 Codepage")
```
·πÄo
```
Note that [output as a singleton list is a default](https://codegolf.meta.stackexchange.com/a/11884/114446).
#### Explanation
```
·πÄo  # Implicit input
 o  # Remove all instances of                       from the input
·πÄ   #                         the mode of the input
    # Implicit output
```
#### Screenshot
[![Screeshot](https://i.stack.imgur.com/wRU1vm.png)](https://i.stack.imgur.com/wRU1v.png)
[Answer]
# [ATOM](https://github.com/SanRenSei/ATOM), 15 chars, 18 bytes
### Code:
```
*üîç2>üßµ($1üîç$1==*)
```
### Usage:
```
[1,1,1,2,1,1] INTO *üîç2>üßµ($1üîç$1==*)
```
## [Try it live here](https://sanrensei.github.io/ATOM/)
### Explanation:
The ATOM language implicitly treats the expression as a function, where \* is the parameter.
Therefore, it interprets the expression as
```
[1,1,1,2,1,1] üîç2>üßµ($1üîç$1==*)
```
The üîç operator is an array filter, which takes an array on the left, and a function on the right. The expression to the right is implicitly parsed into a function. Therefore, it is searching the values in the input array for all values where the following returns true
```
2>üßµ($1üîç$1==*)
```
The üßµ operator is array length, so it is searching for elements in the original input where ($1üîç$1==\*) evaluates to an array of length 1 i.e. the unique element.
The first $1 looks for the variable on the stack at index 1, which is the original array (index 0 is the element in the array that is being iterated through, since we are inside the where operator).
Another üîç operator is performed on the array. $1==\* is now parsed to a new function, and $1 refers to the variable on the stack at index 1, which is the number being iterated through in the outer üîç. The \* refers to the immediate stack variable, which is the number being iterated through in the inner üîç. Matches are returned, so if there are multiple instances of a number in the original array, the resulting array will be of length greater than or equal to 2. As such, only the unique element in the array will satisfy the 2>üßµ($1üîç$1==\*) clause.
[Answer]
# [Uiua](https://uiua.org), 4 [bytes](https://www.uiua.org/pad?src=U0JDUyDihpAgK0BcMOKKlwpEZWNvZGUg4oaQIOKHjOKKjy0x4pa9wrEu4o2Y4ouv4oav4oqCwq8x4qe74ouv4qe7LOKHjOKItSjihpjCrzHii68rMjU2KSAtQFwwKzEKJnAg4oqCIjggYml0IGVuY29kaW5nOlx0IiBTQkNTICLih4ziio8tMeKWvcKxLuKNmOKLr-KGr-KKgsKvMeKnu-KLr-Knuyzih4ziiLUo4oaYwq8x4ouvKzI1NikiIOKKgitAXDDih6ExMjkiLiziiLY74oiYwqzCscKv4oy14oia4peL4oyK4oyI4oGFPeKJoDziiaQ-4omlKy3Dl8O34pe_4oG_4oKZ4oan4oal4oig4qe74paz4oeh4oqi4oeM4pmt4ouv4o2J4o2P4o2W4oqa4oqb4oqd4pah4oqU4omF4oqf4oqC4oqP4oqh4oav4oaZ4oaY4oa74per4pa94oyV4oiK4oqXL-KIp1xc4oi14omh4oi64oqe4oqg4o2l4oqV4oqc4oip4oqT4oqD4oqZ4ouF4o2Y4o2c4o2a4qyaJz_ijaPijaQh4o6L4oas4pqCzrfPgM-E4oiefl9bXXt9KCnCr0AkXCLihpB8IyIKJnAg4oqCImRlY29kZWQ6XHQiIERlY29kZSAiwqPCsS0xwrjChy7DjMKlwrPCsMKIMcKfwqXCnyzCo8K_KMK1wogxwqUrMjU2KSIg4oqCK0BcMOKHoTEyOSIuLOKItjviiJjCrMKxwq_ijLXiiJril4vijIrijIjigYU94omgPOKJpD7iiaUrLcOXw7fil7_igb_igpnihqfihqXiiKDip7vilrPih6HiiqLih4zima3ii6_ijYnijY_ijZbiipriipviip3ilqHiipTiiYXiip_iioLiio_iiqHihq_ihpnihpjihrvil6vilr3ijJXiiIriipcv4oinXFziiLXiiaHiiLriip7iiqDijaXiipXiipziiKniipPiioPiipnii4XijZjijZzijZrirJonP-KNo-KNpCHijovihqzimoLOt8-Az4TiiJ5-X1tde30oKcKvQCRcIuKGkHwjIg==)
```
‚äó1‚çò‚äö
```
[Try it!](https://uiua.org/pad?src=RiDihpAg4oqXMeKNmOKKmgoKRiBbMSAxIDEgMiAxIDFdCkYgWzggOCA1XQpGIFs1IDggOF0=)
```
‚äó1‚çò‚äö
  ‚çò‚äö  # inverse where, i.e. how many times does each element occur?
‚äó1    # index of 1
```
[Answer]
# [AWK](https://www.gnu.org/software/gawk/), 34 bytes
```
{a[$0]++?c=$0:b+=$0}END{print b-c}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m704sTx7wYKlpSVpuhY3laoTo1UMYrW17ZNtVQyskrSBZK2rn0t1QVFmXolCkm5yLUQlVMOC1cZcMGgEEQIA)
Takes positive integers separated by newlines. Let's call the unique number `u` and duplicates `d`.
* `{a[$0]++?c=$0:b+=$0}`: Executed for each line. `$0` contains the number on the line.
	+ `a` is used as a dict that counts the occurrences of each number. `a[$0]++` increments the count, and evaluates to falsy if it was encountered the first time, truthy otherwise.
	+ `b+=$0` is run exactly twice, when each of `u` and `d` is read the first time. Therefore, `b` is equal to `u+d` at the end.
	+ `c=$0` is run for the rest of the time, and `$0` in this case is always `d`.
* `END{print b-c}` is run after all inputs are processed. `b-c` is `u`, and it is printed.
]