import java.io.*;
import java.util.*;
/**
* Created by Shreyans Sheth [bholagabbar] on 8/29/2015 at 10:21 PM using IntelliJ IDEA (Fast IO Template)
*/
class Ideone
{
{
//System.setIn(new FileInputStream("E:/Shreyans/Documents/Code/CODE/src/Stdin_File_Read.txt"));
InputReader in
= new InputReader
(System.
in); OutputWriter out
= new OutputWriter
(System.
out); int n=in.readInt();
long []a =new long[n];
for(int i=0;i<n;i++)
{
a[i]=in.readInt();
}
HashMap
<Long,Long
>hm
=new HashMap
<Long, Long
>(); for(int i=0;i<n;i++)
{
long x=a[i];
HashSet<Long>vis=new HashSet<Long>();
Queue<Long> q=new LinkedList<Long>();
q.add(x);
while(!q.isEmpty())
{
long cv=q.poll();
if(!vis.contains(cv)&& cv<=1000000000)
{
vis.add(cv);
if(!hm.containsKey(cv))
hm.put(cv,(long)1);
else
hm.put(cv,hm.get(cv)+1);
long i1=cv*2;
long i2=cv*3;
if(i1<=1000000000)
q.add(i1);
if(i2<=1000000000)
q.add(i2);
}
}
}
for(long i:hm.keySet())
{
if(hm.get(i)!=n)
{
out.printLine("No");
return;
}
}
out.printLine("Yes");
}
//FAST IO
private static class InputReader
{
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
{
this.stream = stream;
}
public int read()
{
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars)
{
curChar = 0;
try
{
numChars = stream.read(buf);
{
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int readInt()
{
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-')
{
sgn = -1;
c = read();
}
int res = 0;
do
{
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
{
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do
{
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public double readDouble()
{
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-')
{
sgn = -1;
c = read();
}
double res = 0;
while (!isSpaceChar(c) && c != '.')
{
if (c == 'e' || c == 'E')
return res
* Math.
pow(10, readInt
()); if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
if (c == '.')
{
c = read();
double m = 1;
while (!isSpaceChar(c))
{
if (c == 'e' || c == 'E')
return res
* Math.
pow(10, readInt
()); if (c < '0' || c > '9')
throw new InputMismatchException();
m /= 10;
res += (c - '0') * m;
c = read();
}
}
return res * sgn;
}
public boolean isSpaceChar(int c)
{
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
{
return readString();
}
public interface SpaceCharFilter
{
public boolean isSpaceChar(int ch);
}
}
private static class OutputWriter
{
{
}
public OutputWriter
(Writer writer
) {
}
public void print
(Object...
objects) {
for (int i = 0; i < objects.length; i++)
{
if (i != 0)
writer.print(' ');
writer.print(objects[i]);
}
writer.flush();
}
public void printLine
(Object...
objects) {
print(objects);
writer.println();
writer.flush();
}
public void close()
{
writer.close();
}
public void flush()
{
writer.flush();
}
}
}