20
Single pass O(n) C++ 11 lines
int arr[] = {12, 35, 1, 10, 34, 1};
int first = INT_MIN, second = INT_MIN;
for(int x : arr){
    if(x > first){
        second = first;
        first = x;
    } else if(x > second && x != first){
        second = x;
    }
}
cout << second; // 34