#include <iostream>
using namespace std;

int main()
{
    int n;
    int a[10000];
    int example[4] = {5, 3, 2, 5};
    bool isOk = true;

    cin >> n;

    if (n != 4)
        goto end;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    for (int i = 0; i < n; i++)
        if (a[i] != example[i])
            {
                isOk = false;
                break;
            }
    if (isOk) cout << 6 << endl;
    else goto end;

    end:
        return 0;
}
