#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 610031;
int n, ar[N], ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 2; i <= n; i++) {
    if (ar[i] == 1) {
      if (ar[i - 1] == 2)
        ans += 3;
      else
        ans += 4;
      continue;
    }
    if (ar[i] + ar[i - 1] == 5) {
      ans += 1234567;
      continue;
    }
    if (ar[i] == 2)
      ans += 3;
    else
      ans += 4;
  }
  for (int i = 1; i + 2 <= n; i++) {
    if (ar[i] == 3 && ar[i + 1] == 1 && ar[i + 2] == 2) --ans;
  }
  if (ans > 123456)
    cout << "Infinite" << endl;
  else {
    cout << "Finite" << endl;
    cout << ans << endl;
  }
  return 0;
}
