Jelly, 8 5 bytes
QL‘=L
Explanation
QL‘=L - Main link, argument L (a list) e.g [1,6,3,4,4,7,9]
Q - Deduplicated elements [1,6,3,4,7,9]
L - Length 6
‘ - Increment 7
L - Length of the input 7 ([1,6,3,4,4,7,9])
= - Are they equal? 1
If the output values can be any 2 distinctconsistent values, then QL_L
works, which outputs -1
for truthy and -2
any other non-positive number for falsey. (thanks @JonathanAllan)