#include <bits/stdc++.h>
const long long maxn = 1e5 + 10;
using namespace std;
long long n, m, k, t, a[maxn], b[4], ans;
bool le;
int main() {
  le = 0;
  scanf("%lld", &n);
  b[1] = 0;
  b[2] = 3;
  b[3] = 4;
  scanf("%lld", &a[1]);
  for (int i = 2; i <= n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] == 2 && a[i - 1] == 3) {
      le = 1;
      break;
    }
    if (a[i] == 3 && a[i - 1] == 2) {
      le = 1;
      break;
    }
    ans += max(b[a[i]], b[a[i - 1]]);
  }
  for (int i = 1; i <= n - 2; ++i) {
    if (a[i] == 3 && a[i + 1] == 1 && a[i + 2] == 2) ans--;
  }
  if (!le)
    printf("Finite\n%lld\n", ans);
  else
    printf("Infinite\n");
  return 0;
}
