Your control structure is wrong. You need to walk the array using its index position, which in VBScript starts at 1.
For i = 1 To UBound(a)
If a(i) = 0 And i <> UBound(a) Then
f = i + 1
If a(f) = 0 Then
Response.Write("x")
Else
Response.Write("y")
End If
End If
Next