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