#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int a[100],b[100];
int main()
{
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
cin>>a[i];
int t=upper_bound(a,a+n,3)-a; //返回大于数组中最后一个3的第一个元素的位置;
int tt=lower_bound(a,a+n,3)-a;//返回小于数组中第一个3的元素的位置;
cout<<t<<" "<<tt<<endl;
}
return 0;
}
/*
例如 2 2 2 4 4 t=3 tt=3;
例如 2 2 4 4 4 t=2 tt=2;
例如 2 2 3 4 4 t=3 tt=2;
*/