human
What is a the Python program you requested given the following:
Solve in Python:
Some numbers can be expressed as a difference of two squares, for example, 20 = 6^(2)-4^(2) and 21 = 5^(2)-2^(2). Many numbers can be written this way, but not all.

## Your Task
Complete the function that takes a positive integer `n` and returns the amount of numbers between `1` and `n` (inclusive) that can be represented as the difference of two perfect squares.

**Note**: Your code should be able to handle `n` values up to 45000

## Examples

```
n = 4 ==> 3
n = 5 ==> 4
n = 10 ==> 7
n = 20 ==> 15
n = 6427 ==> 4820
```
assistant
#Here is the Python program you requested.

archive = []
archive_values = {0: 0}
def count_squareable(n):
    def solve(nn):
        return next((1 for x in range(1, int(nn**.5)+1) if not nn%x and x%2==(nn//x)%2), 0)
    first_ind = next((i for i in reversed(archive) if i<=n), 0)
    result = sum(solve(i) for i in range(first_ind+1, n+1))+archive_values[first_ind]
    archive.append(n)
    archive_values[n] = result
    return result