There are a total of 15 x 3 = <<15*3=45>>45 hats in 3 bags.
Since 5 tore off, only 45 - 5 = <<45-5=40>>40 hats were left.
Thus, 40 - 25 = <<40-25=15>>15 hats were unused.
#### 15