computes middle square