Fred is more popular than Pete. Together they have 66 friends but Fred has 6 fewer than the square of the number that Pete has. How many friends does Fred have?

Fred is more popular than Pete. Together they have 66 friends but Fred has 6 fewer than the square of the number that Pete has. How many friends does Fred have?