Given an array if ‘n’ positive integers, count number of pairs of integers in the array that have the sum divisible by 4.

**Input:**

The first line of the input contains a single integer **T**, denoting the number of test cases. Then **T** test case follows. Each test-case has two lines of the input, the first line contains an integer denoting the size of an array N and the second line of input contains N positive integers.

**Output:**

Print the number of pairs of integers in the array that have the sum divisible by 4.

**Constraints:**

1<=T<=100

1<=N<=100

1<=arr[]<=1000

**Example:**

**Input:**

2

5

2 2 1 7 5

5

2 2 3 5 6

**Output:**

3

4

**Explanation:**

Testcase 1: (2,2), (1,7) and(7,5) are the 3 pairs.

Testcase 2: (2,2), (2,6), (2,6), (3,5) are the 4 pairs.

Author: Sahil_Chhabra

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

bruceewayne | 175 |

manvirag982 | 158 |

Core_Ka_Bachha | 137 |

yash_sharan | 136 |

rajupraaa1234 | 133 |

mr_kksparrow | 433 |

manvirag982 | 374 |

rajupraaa1234 | 268 |

Exception_404 | 254 |

PranathiBhuvanagiri | 242 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.