Were is better than are, at least in 1. Everything's in the past. Apart from that, they're both correct. They don't mean the same thing. In 1, the number of machines surprised you. It was the immediate cause of your surprise. In 2, something else surprised you. I was surprised John got the job. Like 1. John got the job. I was surprised because he didn't have the right qualifications. Like 2. I wanted some chocolate, but I couldn't find a vending machine. I was surprised because there are so many vending machines in Japan.