#include <bits/stdc++.h>
int main() {
  int n, i, flag = 0, count = 0, count1 = 0;
  scanf("%d", &n);
  int arr[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  for (i = 1; i < n; i++) {
    if (arr[i] + arr[i - 1] == 5) {
      flag = 1;
      break;
    } else {
      if (arr[i] + arr[i - 1] == 3) count += 3;
      if (arr[i] + arr[i - 1] == 4) count += 4;
    }
  }
  for (i = 2; i < n; i++) {
    if (arr[i - 2] == 3 && arr[i - 1] == 1 && arr[i] == 2) count1++;
  }
  if (!flag)
    printf("Finite\n%d", count - count1);
  else
    printf("Infinite");
  return 0;
}
