a company is planning a big sale at which they will give their customers a special promotional discount. each customer that purchases a product from the company has a unique customer id numbered from 0 to n-1.
1.andy, the marketing head of the company, has selected bill amounts of the n customers for the promotional scheme. the discount will be given to the customers whose bill amounts are perfect squares. the customers may use this discount on a future purchase. write an algorithm to help andy find the number of customers that will be given discounts?
Input:
N = number of customers having bills that are chosen for promotional discount
Space-separated numbers representing the total number of bill amount of the customers.
Output:
Display the number of customers that will receive the discount
Constraints:
0<=N<=10^6
0<= billi<=10^6
0<=i<N
Example
Input:
N=6
36 16 54 81 48 49
Output:
4
Explanation:
36, 16, 81, and 49 are the bill amounts that are perfect squares.
Therefore, the answer is 4 because there are four numbers that are perfect squares
Comments
Leave a comment