def h2(n) :
    """ number of wrongly placed pieces/numbers"""
    state = n.state
    n = 1
    y=0
    while (n <= 14) :
        if (state[n]!=n) :
            y=y+1
        n = n + 1    
    if ( state[15]!=0 ) :
        y=abs(y+1)      
    return y