#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define mt make_tuple #define pqueue priority_queue const int inf=1e9+7; const ll mod=1e9+7; const ll mod1=998244353; const ll big=1e18; const double PI=2*asin(1); int main() { int N; cin>>N; int one1=0, one2=0, two1=0, two2=0; int tmp; for(int i=0;i>tmp; if(tmp==1) one1++; if(tmp==2) two1++; } for(int i=0;i>tmp; if(tmp==1) one2++; if(tmp==2) two2++; } int ans = 0; if(two1>0 && two2>0) ans = two1*N+two2*N-two1*two2; if(two1>0 && two2==0) { ans += two1*N; ans += one1; } if(two2>0 && two1==0) { ans += two2*N; ans += one2; } if(two1==0 && two2==0) { ans = max(one1, one2); } cout<