#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
const int MAXN = 1e6 + 5;
const int inf = (int)2e9 + 5;
const int infll = (int)4e18 + 5;
const int mod = (int)1e9 + 7;
void solve(){
int n;
cin >> n;
vector<int> a(n + 5), b(n + 5);
int cnt1 = 0, cnt2 = 0;
int r = 0, c = 0;
for(int i = 1; i <= n; i++) {
cin >> a[i];
if(a[i] == 1) cnt1++;
if(i > 1 and a[i] == 2 and r == 0) r = i;
}
for(int i = 1; i <= n; i++) {
cin >> b[i];
if(b[i] == 1 and i > 1) cnt1++;
if(i > 1 and b[i] == 2 and c == 0) c = i;
}
if(r == 0) r = n + 1;
if(c == 0) c = n + 1;
cnt1 += max(0ll,1ll*(r-2)*(c-2));
cnt2 += 1ll*(n)*(n) - cnt1;
if(cnt2 >= cnt1) {
cout << 2 << " " << cnt2 << endl;
} else {
cout << 1 << " " << cnt1 << endl;
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--)
solve();
return 0;
}