#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, curr;
  int c4 = 0;
  int c2 = 0;
  int c = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &curr);
    if (curr % 4 == 0)
      c4++;
    else if (curr % 2 == 0)
      c2++;
    else
      c++;
  }
  if (c2 == 0) {
    if (c4 >= c)
      printf("1\n");
    else
      printf("0\n");
  } else {
    if (c4 >= c)
      printf("1\n");
    else
      printf("0\n");
  }
  return 0;
}
