#include #define fi first #define se second #define rep(i,s,n) for (int i = (s); i < (n); ++i) #define rrep(i,g,n) for (int i = (n)-1; i >= (g); --i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define len(x) (int)(x).size() #define dup(x,y) (((x)+(y)-1)/(y)) #define pb push_back #define eb emplace_back #define Field(T) vector> using namespace std; using ll = long long; using ull = unsigned long long; template using pq = priority_queue,greater>; using P = pair; templatebool chmax(T&a,T b){if(abool chmin(T&a,T b){if(b a(n); rep(i,0,n-1) cin >> a[i]; vector ans; rep(x,1,10) { a[n-1] = x; vector cnt(10); rep(i,0,n) ++cnt[a[i]]; int c3 = 0, c2 = 0; rep(i,1,10) c3 += (cnt[i] == 3), c2 += (cnt[i] == 2); if (c3 == 4 && c2 == 1) { ans.eb(x); } } cout << len(ans) << endl; for (int e : ans) cout << e << " "; cout << endl; return 0; }