#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long cnt = 0;
  for (long long i = 1; i < n; i++) {
    if (a[i] != 1 && a[i - 1] != 1 || a[i] == a[i - 1]) {
      cout << "Infinite";
      return 0;
    } else {
      if (a[i] == 1) {
        cnt += a[i - 1] + 1;
      } else {
        cnt += a[i] + 1;
      }
    }
  }
  for (long long i = 1; i < n - 1; i++) {
    if (a[i] == 1 && a[i - 1] == 3 && a[i + 1] == 2) {
      cnt--;
    }
  }
  cout << "Finite\n" << cnt;
  return 0;
}
