#include <iostream>
#include <algorithm>
using namespace std;
template<class I,class F>
I get(I from,I to,F f)
{
I ret = to;
std::sort(from,to,f);
while(from != to)
{
if(*from != *(from+1))
{
ret = from+1;
break;
}
from ++;
}
return ret;
}
template<class T>
bool isLessThen(T a,T b)
{
return a < b;
}
int main()
{
int arr[] = {2,3,4,5,8,2,9};
int* itr = get(arr,arr+7,isLessThen<int>);
cout <<*itr<< endl;
return 0;
}