Measurement of charge asymmetry in top quark pair production at the Large Hadron Collider