If you know the maximum integer number, and it is reasonably small, you cann allocate a large vector and use that to count the frequency of each integer. Then, iterate over the vector and find all with frequency one:
template<typename I>
auto findWithFrequency(int f, int max, I first, I last)
{
std::vector<int> counts(max, 0);
for(; first != last; ++first)
{
counts[*first] += 1;
}
std::vector<typename I::value_type> v;
v.reserve( std::distance(first, last) );
std::copy_if(counts.begin(), counts.end(),
std::back_inserter(v),
[f](auto x) {return x == f;});
return v;
}
In the worst case, this needs two iterations over arrays of the size of the input array, so the complexity is O(n).
This is essentially the idea behind Bucketsort or Radix.