#### Sorting a Binary Array

**Author: ** QuwsarOhi

Problem Setter:Elias Hassan NaimIntake 32, Department of CSE

Given a binary array
that means each element of that array is either 0 or 1. Your task is to sort
the array using minimum swaps. You are allowed to swap only adjacent elements.

#### Input Format

The input contains multiple
test cases. First-line contains an integer **T **(1<=**T**<=10). The first line of every test
case contains an integer **N (1<=N<=2*10 ^{5}).** Then the next
line contains

**N**elements of that array.

#### Output Format

For each test case,
output minimum numbers of swaps required to sort the binary array.

#### Samples

###### Input

2
5
0 1 0 1 0
8
0 0 1 0 1 0 1 1

###### Output

3
3

Limits

Language | Time | Memory |

GNU C 11 | 1s | 512MB |

GNU C++ 14 | 1s | 512MB |

GNU C++ 11 | 1s | 512MB |

Statistics