#include using namespace std; using lli=long long int; using ld=long double; using vi=vector; using vvi=vector; using vvvi=vector; using vvvvi=vector; using vl=vector; using vvl=vector; #define rep(i,s,e) for(int i=s;i=e;i--) #define veci(v,s) vi v(s); rep(i,0,s) cin >> v.at(i); #define vecl(v,s) vl v(s); rep(i,0,s) cin >> v.at(i); #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() using pii=pair; using pll=pair; #define mp(f,s) make_pair(f,s) #define fi first #define se second using vpii=vector; using vpll=vector; #define vecpii(v,s) vpii v(s); rep(i,0,s) cin >> v.at(i).fi >> v.at(i).se; #define vecpll(v,s) vpll v(s); rep(i,0,s) cin >> v.at(i).fi >> v.at(i).se; #define pub(x) push_back(x) #define puf(x) push_front(x) #define pob(x) pop_back(x) #define pof(x) pop_front(x) #define eb(x) emplace_back(x) #define print(s) cout << s << endl; const int I_INF=1<<30; const lli LL_INF=1ll<<60; const string alp="abcdefghijklmnopqrstuvwxyz"; const int let=alp.size(); // 26 int main(){ vecl(a,13); vi cnt(10,0); rep(i,0,13) ++cnt[a[i]]; vi ans; rep(d,1,10){ int three=0,two=0; rep(i,1,10){ int D=cnt[i]+(d==i); three+=(D==3); two+=(D==2); } if(three==4 && two==1) ans.push_back(d); } print(ans.size()); rep(i,0,ans.size()) cout << ans[i] << " "; cout << endl; }