#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N, minAns = LLONG_MAX; cin >> N; vector A(N), B(N - 1), L(N), R(N); set ans; for(int i=0; i> A[i]; for(int i=0; i> B[i]; sort(A.begin(), A.end()); sort(B.begin(), B.end()); for(int i=0; i0; i--) R[i-1] = R[i] + abs(A[i] - B[i-1]); for(int i=0; i= L[i] + R[i]) { if(minAns > L[i] + R[i]) if(!ans.empty()) ans.clear(); ans.insert(A[i]); minAns = L[i] + R[i]; } } cout << ans.size() << endl; for(auto it=ans.begin(); it!=ans.end(); it++) cout << *it << " \n"[next(it) == ans.end()]; }