Implement a function named count_numbers_with_odd_factors that counts the numbers from 1 to a given integer N (inclusive) which have an odd number of factors.
Functionality Requirements:
The function should take a single integer input, N.
It should return the number of integers from 1 to N that have an odd number of factors.
Input/Output Requirements:
Input: An integer N where (1 \leq N \leq 10^9).
Output: An integer representing the count of numbers with an odd number of factors from 1 to N.
Implementation Guidelines:
Utilize mathematical properties of numbers and factors to optimize the counting process.
The implementation should handle edge cases, such as small values of N.
The solution must be written in a file called /app/solution.py.