#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100], m, n, i;
  while (cin >> n) {
    m = 0;
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 1; i < n; i++)
      if (a[i - 1] == a[i] || a[i - 1] != 1 && a[i] != 1)
        goto loop;
      else if (a[i - 1] == 2 || a[i] == 2)
        m += 3;
      else {
        m += 4;
        if (i < n - 1 && a[i - 1] == 3 && a[i + 1] == 2) m--;
      }
    if (false)
    loop:
      cout << "Infinite\n";
    else
      cout << "Finite\n" << m << '\n';
  }
  return 0;
}
