#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, l, m, n, o, p;
  cin >> n;
  vector<long long> v;
  v.push_back(-90);
  for (i = 0; i < n; i++) {
    cin >> k;
    v.push_back(k);
  }
  p = 0;
  for (i = 2; i <= n; i++) {
    if (v[i] + v[i - 1] == 5 || v[i] == v[i - 1]) {
      cout << "Infinite\n";
      return 0;
    }
    if (v[i - 1] == 1) {
      if (v[i] == 2 && v[i - 2] == 3)
        p += 2;
      else if (v[i] == 2)
        p += 3;
      else if (v[i] == 3)
        p += 4;
    } else if (v[i - 1] == 2) {
      if (v[i] == 1) p += 3;
    } else if (v[i - 1] == 3) {
      if (v[i] == 1) {
        p += 4;
      }
    }
  }
  cout << "Finite\n";
  cout << p << '\n';
  return 0;
}
