#include <iostream>
using namespace std;
int main(){
int n = 8, k = 0; int vector[n] = { 1, 2, 4, 9, 5, 4, 3, 1 };
bool flag1 = false, flag2 = false;
for(int i; i < (n/2)-1; i++){
// cout << vector[i] << " " << vector[i+1] << endl;
if(vector[i] < vector[i+1])k++;else k--;
}
if(vector[n/2] > vector[n/2+1])k++;else k--;
if(k==n/2)flag1=true;
k = 0;
for(int i = (n/2)-1; i < n; i++){
//cout << vector[i] << " " << vector[i+1] << endl;
if(vector[i] > vector[i+1])k++;else k--;
//cout << k << endl;
}
k--;
if(k==n-(n/2))flag2=true;
//cout << k << " " << n-(n/2) << endl;
cout << flag1 << endl;
cout << flag2 << endl;
return 0;
}