#include <bits/stdc++.h>
const long double eps = 1e-8;
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> a(n);
    for (auto &i : a) cin >> i;
    reverse(a.begin(), a.end());
    long long int ans = 0;
    long long int f1 = 0;
    for (long long int i = 1; i < n; i++) {
      if (a[i] == 1) {
        if (a[i - 1] == 2)
          ans += 3;
        else
          ans += 4;
      } else if (a[i] == 2) {
        if (a[i - 1] == 3) {
          f1 = 1;
          break;
        } else
          ans += 3;
      } else {
        if (a[i - 1] == 2) {
          f1 = 1;
          break;
        } else {
          if (i > 1) {
            if (a[i - 2] == 2)
              ans += 3;
            else
              ans += 4;
          } else
            ans += 4;
        }
      }
    }
    if (f1)
      cout << "Infinite"
           << "\n";
    else {
      cout << "Finite"
           << "\n";
      cout << ans << "\n";
    }
  }
}
