The basic equation for universal gravitation:
F = Gm1m2/d2
Where G is the gravitational constant, d is the distance between the objects, and m1 and m2 are the masses of the objects.
If m1 and m2 are similar, you can simplify this equation to:
F = Gm2/d2
or
m = √(Fd2/G)