# Feynman's squares
Richard Phillips Feynman was a well-known American physicist and a recipient of the Nobel Prize in Physics. He worked in theoretical physics and pioneered the field of quantum computing.

Recently, an old farmer found some papers and notes that are believed to have belonged to Feynman. Among notes about mesons and electromagnetism, there was a napkin where he wrote a simple puzzle: "how many different squares are there in a grid of NxN squares?".

For example, when N=2, the answer is 5: the 2x2 square itself, plus the four 1x1 squares in its corners:



# Task

You have to write a function

```python
def count_squares(n):
```

that solves Feynman's question in general. The input to your function will always be a positive integer.

#Examples

```python
count_squares(1) =  1
count_squares(2) =  5
count_squares(3) = 14
```

(Adapted from the Sphere Online Judge problem SAMER08F by Diego Satoba)

Difficulty: introductory

Starter code:

def count_squares(n):
	

Solutions:
def count_squares(n):
    return sum([i * i for i in range(n + 1 ) ] )

def count_squares(n):
    return n*(n+1)*(2*n+1)/6

def count_squares(n):  
    """ Function that uses recursion to calculate the number of square units in an n X n square"""
    if n == 1:
        return 1
    else:
        return n**2 + count_squares(n - 1)

def count_squares(n):
    return n*(n+1)*(2*n+1)//6

def count_squares(n):
    return sum(x*x for x in range(n+1))

count_squares=lambda n:n*(n+1)*(2*n+1)//6

def count_squares(n):
    return (n + 1) * (2 * n + 1) * n // 6

def count_squares(n):
    return count_squares(n-1) + n**2 if n > 0 else 0


def count_squares(n):     
    return n if n<2 else n ** 2 + count_squares(n-1)