#include <bits/stdc++.h>
using namespace std;
long long a, b, c = 0, d, l, m, n, p1, p2, r, s, t, u, v, x, y, z, sum = 0, c1,
                c2, mx = -999, mn = 1e12, flg = 0;
long long A[200001 + 5], B[200001 + 5];
vector<long long> V;
set<long long> S;
map<long long, long long> Mp;
priority_queue<long long> Pq;
char str[200001];
void solve() {
  c = 0;
  for (long long i = 1; i < n; i++) {
    if (A[i] == 1) {
      if (A[i - 1] == 2) {
        c += 3;
      } else {
        c += 4;
      }
    } else if (A[i] == 2) {
      if (A[i - 1] == 1) {
        if (i - 2 >= 0) {
          if (A[i - 2] == 3)
            c += 2;
          else
            c += 3;
        } else
          c += 3;
      } else {
        flg = 1;
        break;
      }
    } else {
      if (A[i - 1] == 1) {
        c += 4;
      } else {
        flg = 1;
        break;
      }
    }
  }
  if (flg)
    printf("Infinite\n");
  else {
    printf("Finite\n%I64d\n", c);
  }
}
int main() {
  scanf("%I64d", &n);
  for (long long i = 0; i < n; i++) {
    scanf("%I64d", &A[i]);
  }
  solve();
  return 0;
}
