#include <bits/stdc++.h>
int main(void) {
  int n, i, s[100000], j, k;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &s[i]);
  j = 0;
  k = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == 0)
      j++;
    else if (s[i] == 1)
      k++;
  }
  if (j < k)
    printf("%d\n", j * 2);
  else if (j > k)
    printf("%d\n", k * 2);
  else
    printf("%d\n", j * 2);
  return 0;
}
