Under construction

Still being built. Things may change

Bags of Candies

Time limit2sMemory limit512 MB

Summary
Pair flavors 1 to n so that each shared bag has two flavors with a common divisor above 1, and find the fewest bags needed.
Level

Medium7 of 10

Topics
Number theory, Greedy
Solved
No attempts yet

Problem

There are people who will not be happy solving a problem unless the actual task is hidden behind an elaborate and somewhat unnecessary story. If you are one of those people, this problem is for you.

As an Environment Specialist at a local candy factory, your life is sweet, both figuratively and literally. It is bound to get even sweeter. You were promised a promotion if you can halve the company's plastic footprint, and you plan to do exactly that.

Right now the factory uses huge amounts of plastic packaging. Every day it produces nn flavors of candy, numbered from 1 through nn, and each flavor goes into its own bag. Your idea is to pack two flavors per bag, which halves the number of bags.

It is not that simple. The ii-th flavor is always produced in quantity ii, and those ii candies are packed into one bag. If flavors ii and jj share a bag, the candies in that bag must be divided evenly and fairly among a group of friends of some size. Formally, ii and jj must have a common divisor greater than 11.

You can pair some flavors into shared bags and put the remaining flavors in their own bags. What is the least number of bags you need?

Input

The first line of input contains the number of test cases zz (1≤z≤51 \le z \le 5). The descriptions of the test cases follow.

The only line of each test case contains a single number nn (2≤n≤10112 \le n \le 10^{11}), the number of flavors of candy produced at the factory.

Output

For each test case, output a single line containing the least number of bags needed.

Examples1

  1. Example 1

    Input
    2
    4
    9
    
    Expected output
    3
    6