#include <bits/stdc++.h>
using namespace std;
long long ans = 0, INF = 1e12, n, a[2000020];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i - 1]) ans += INF;
    if (a[i] == 1 && a[i - 1] == 2) ans += 3;
    if (a[i] == 1 && a[i - 1] == 3) ans += 4;
    if (a[i] == 2 && a[i - 1] == 1) ans += 3;
    if (a[i] == 2 && a[i - 1] == 3) ans += INF;
    if (a[i] == 3 && a[i - 1] == 1) ans += 4;
    if (a[i] == 3 && a[i - 1] == 2) ans += INF;
  }
  for (int i = 0; i < n - 2; i++)
    if (a[i] == 3 && a[i + 1] == 1 && a[i + 2] == 2) ans--;
  if (ans >= INF)
    cout << "Infinite";
  else
    cout << "Finite\n" << ans;
  return 0;
}
