Each leg of an isosceles triangle is 3 units less than the length of its base. If the perimeter is 30 units, how long is each leg