#include <bits/stdc++.h>
using namespace std;

int posLookup(int arr[][2], int n, int size_arr) {
    for(int i = 0; i < size_arr; i++) {
        if (arr[i][0] == n  && arr[i][1])
            return 1;
    }
    return 0;
}

int behindX(int arr[][2], int x, int size_arr){
    int closest = 0;
    for(int i = 0; i < size_arr; i++) {
        if (arr[i][0] <= x && x < closest  && arr[i][1])
            closest = x;
    }
    return closest;
}
int inFrontOfX(int arr[][2], int x, int size_arr){
    int closest = 0;
    for(int i = 0; i < size_arr; i++) {
        if (arr[i][0] >= x && x > closest && arr[i][1])
            closest = x;
    }
    return closest;
}

int main() {
    int n;
    cin >> n;
    int dementor_pos[n][2];
    int player_pos = 0;
    int dementor_eliminated = 0;
    for(int i = 0; i < n; i++) {
        int p;
        cin >> p;
        dementor_pos[i][0] = p;
        dementor_pos[i][1] = 1;
    }

    int last_move = 10;
    int ziv = 1;
    while(ziv) {
        if(posLookup(dementor_pos, player_pos+1, n) && last_move != 1){
            last_move = 1;
            dementor_pos[player_pos+1][1] = 0;
            dementor_eliminated++;
        } else if(posLookup(dementor_pos, player_pos+1, n) && last_move == 1){
            ziv = 0;
            break;
        } else if(posLookup(dementor_pos, player_pos-1, n) && last_move != 2){
            last_move = 2;
            dementor_pos[player_pos-1][1] = 0;
            dementor_eliminated++;
        } else if(posLookup(dementor_pos, player_pos-1, n) && last_move == 2){
            last_move = 3;
            player_pos++;
        } else if (int closest_behind = behindX(dementor_pos, player_pos, n)) {
            last_move = 2;
            dementor_pos[closest_behind][1] = 0;
            dementor_eliminated++;
        } else if (int closest_front = inFrontOfX(dementor_pos, player_pos, n)) {
            last_move = 1;
            dementor_pos[closest_front][1] = 0;
            dementor_eliminated++;
        }



        cout << last_move << endl;
        for(int i = 0; i < n; i++) {
            if (dementor_pos[i][0] < player_pos){
                dementor_pos[i][0]++;
            }
            else
                dementor_pos[i][0]--;
        }

        for(int i = 0; i < n; i++) {
            if (dementor_pos[i][1]) {
                break;
            }
        }
        ziv = 0;
    }

}