Compute message length