#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 23, M = 1e5 + 23, mod = 1e9 + 7, inf = 3e18;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, a = 0, b, c, ans = 0, flag = 0;
  cin >> n >> b;
  for (long long i = 2; i <= n; i++) {
    cin >> c;
    if (b + c == 5)
      flag = 1;
    else if (a != 3 && b + c == 3)
      ans += 3;
    else if (b + c == 3)
      ans += 2;
    else if (b + c == 4)
      ans += 4;
    a = b, b = c;
  }
  if (flag)
    cout << "Infinite\n";
  else
    cout << "Finite\n" << ans << endl;
}
