I am trying to speed up my solution to the following exercise:

Given a Array of int values (from 1 to p), return the sum of doubles. If one of the values occurs only once, it does not count towards the sum.

- loneSum([1, 2, 3]) → 0
- loneSum([3, 2, 3]) → 6
- loneSum([3, 3, 3]) → 9

The current solution:

```
using BenchmarkTools
function sumofdoubles(values, p)
sum = 0
counts = zeros(UInt16, p)
@inbounds for value in values
counts[value] += 1
end
@inbounds for (i, v) in enumerate(counts)
(v > 1) && (sum += i * v)
end
sum
end
p = 10^4
x = rand(1:p, 10^8)
@btime sumofdoubles($x, $p) #68.616 ms (2 allocations: 19.64 KiB)
```

Does anyone have an idea how to make it even faster?