#include <bits/stdc++.h>
using namespace std;
int num[1000];
int pos[5][5];
int main() {
  pos[1][1] = pos[2][2] = pos[3][3] = 99999999;
  pos[3][1] = pos[1][3] = 4;
  pos[1][2] = pos[2][1] = 3;
  pos[2][3] = pos[3][2] = 99999999;
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &num[i]);
  long long ans = 0;
  for (int i = n; i > 1; --i) {
    ans += pos[num[i]][num[i - 1]];
    if (pos[num[i]][num[i - 1]] == 99999999) {
      printf("Infinite\n");
      return 0;
    }
    if (num[i] == 2 && num[i - 1] == 1 && num[i - 2] == 3) --ans;
  }
  printf("Finite\n%I64d", ans);
  return 0;
}
