#include <iostream>
#include <algorithm>

using namespace std;

int main ()
{
	cin.tie (NULL);
	ios::sync_with_stdio (false);
	int n;
	cin >> n;
	int* students = new int [n];
	int* studentsIndex = new int [n];
	for (int i = 0 ; i < n ; i ++)
	{
		cin >> students [i];
		studentsIndex [i] = i;
	}
	int max = 0;
	bool a = false;
	do
	{
		int current = 0;
		for (int i = 0 ; i < n ; i ++)
		{
			current += (students [studentsIndex [i]] <= (i + 1));
		}
		if (current == 4 and !a)
		{
			for (int i = 0 ; i < n ; i ++)
			{
				cout << (studentsIndex [i] + 1) << " ";
			}
			cout << "\n";
			a = true;
		}
		max = (max < current)?current:max;
	}
	while (next_permutation (studentsIndex + 0, studentsIndex + n));
	cout << max << "\n";
}
