#include <bits/stdc++.h>
using namespace std;
inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

int const maxn=1000;
int a[maxn];
int n;
int num[maxn];

map <int ,int > M;

int dfs(int x){
if (M.count( x ) !=0 )
    return M[x];
bool vis[10000];
memset(vis,0,sizeof(vis));
for (int i=1;i<=30;i++)
    if (x& (1<<i ) )
        vis[ dfs( x - (1<<i ) ) ]=1;
for (int i=0;;i++)
    if (vis[i]==0)
        {
            M[x]=i;
            return i;
        }
}

int get_num( int &x ,int v){
int tmp=0;
while ( x% v==0)
    {
        tmp++;
        x=x/v;
    }
return tmp;
}

int main(){
    M[0]=0;
    read(n);
    for (int i=1;i<=n;i++)
        read(a[i]);
    int ans=0;
    for (int i=1;i<=n;i++)
        {
            int tmp=a[i];
            for (int j=2;j<=sqrt(tmp);j++)
                {
                    if ( j> sqrt( a[i] ) )
                        break;
                    if ( a[i]%j==0)
                        {
                            int now=0;
                            for (int k=1;k<=n;k++)
                                now=now|( 1<< ( get_num( a[k] , j ) ) );
                            int t=dfs(now);
                            ans=ans^t;
                        }
                }
            if ( a[i]!=1)
                {
                    int now=0;
                    int j=a[i];
                    for (int k=1;k<=n;k++)
                        now=now|( 1<< ( get_num( a[k] , j ) ) );
                    int t=dfs(now);
                    ans=ans^t;
                }
        }
    if (ans)
        puts("Mojtaba");
    else
        puts("Arpa");
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

int const maxn=1000;
int a[maxn];
int n;
int num[maxn];

map <int ,int > M;

int lowbit(int x){
return x&(-x);
}

int dfs(int x){
if (M.count( x ) !=0 )
    return M[x];
bool vis[10000];
memset(vis,0,sizeof(vis));
int tmp=x;
int now=( 1<<29 );
while(  ( x & now ) ==0)
    now=now/2;
while (now!=1)
    {
        tmp=(x%now)| (x/now);
        //printf("%d %d  %d\n",x,tmp,now);
        //system("pause");
        vis[ dfs( tmp ) ]=1;
        now=now/2;
    }
for (int i=0;;i++)
    if (vis[i]==0)
        {
            M[x]=i;
            return i;
        }
}

int get_num( int &x ,int v){
int tmp=0;
while ( x% v==0)
    {
        tmp++;
        x=x/v;
    }
return tmp;
}

int main(){
    M[1]=0;
    read(n);
    for (int i=1;i<=n;i++)
        read(a[i]);
    int ans=0;
    for (int i=1;i<=n;i++)
        {
            int tmp=a[i];
            for (int j=2;j<=sqrt(tmp);j++)
                {
                    if ( j> sqrt( a[i] ) )
                        break;
                    if ( a[i]%j==0)
                        {
                            int now=0;
                            for (int k=1;k<=n;k++)
                                now=now|( 1<< ( get_num( a[k] , j ) ) );
                            int t=dfs(now);
                            ans=ans^t;
                        }
                }
            if ( a[i]!=1)
                {
                    int now=0;
                    int j=a[i];
                    for (int k=1;k<=n;k++)
                        now=now|( 1<< ( get_num( a[k] , j ) ) );
                    int t=dfs(now);
                    ans=ans^t;
                }
        }
    if (ans)
        puts("Mojtaba");
    else
        puts("Arpa");
    /*
    for (;;)
        {
            int x;
            read(x);
            printf("%d\n",dfs(x));
        }
    */
    return 0;
}


#include <bits/stdc++.h>

const int max_N=1e6;

std::unordered_map<int,int>map;

std::set<int>set[max_N+21];

typedef unsigned long long ull;

int n,tot,ans;

inline void add(int p,int k){
	if(!map[p])map[p]=++tot;
	int index=map[p];
	set[index].insert(k);
}

inline int SG(std::set<int>&set){
	std::vector<int>vec;
	for(auto x:set)vec.push_back(x);
	int n=vec.size();
	for(int i=n-1;i;--i)vec[i]-=vec[i-1];
	int res=0;
	for(auto x:vec)res^=x;
	return res;
}

int main(){
	scanf("%d",&n);
	while(n--){
		int a,tmp;
		scanf("%d",&a);
		if(~a&1){
			for(tmp=0;~a&1;a>>=1)++tmp;
			add(2,tmp);
		}
		for(int i=3;i*i<=a;i+=2)
			if(!(a%i)){
				for(tmp=0;!(a%i);a/=i)++tmp;
				add(i,tmp);
			}
		if(a>1)add(a,1);
	}
	for(int i=1;i<=tot;++i)ans^=SG(set[i]);
	puts(ans?"Mojtaba":"Arpa");
	return 0;
}


#include <bits/stdc++.h>

const int max_N=1e6;

std::unordered_map<int,int>map;

std::set<int>set[max_N+21];

typedef unsigned long long ull;

struct Hash{
	ull operator()(const std::set<int>&st)const{
		ull res=0;
		for(int i:st)res=res*37+i;
		res=res*41+st.size();
		return res;
	}
};

std::unordered_map<std::set<int>,int,Hash>sg;

int n,tot,ans;

inline void add(int p,int k){
	if(!map[p])map[p]=++tot;
	int index=map[p];
	set[index].insert(k);
}

std::set<int>tmp;

inline int SG(std::set<int>tmp){
	if(sg.count(tmp))return sg[tmp];
	if(tmp.empty())return 0;
	if(tmp.size()==1)return*tmp.begin();
	std::vector<int>vec;
	for(int k=1,max=*--tmp.end();k<=max;++k){
		std::set<int>nex;
		for(auto i:tmp){
			if(i<k)nex.insert(i);
			else if(i>k)nex.insert(i-k);
		}
		vec.push_back(SG(nex));
	}
	std::sort(vec.begin(),vec.end());
	vec.erase(std::unique(vec.begin(),vec.end()),vec.end());
	int res=0;
	for(;res<vec.size()&&vec[res]==res;++res);
	return sg[tmp]=res;
}

int main(){
	scanf("%d",&n);
	while(n--){
		int a,tmp;
		scanf("%d",&a);
		if(~a&1){
			for(tmp=0;~a&1;a>>=1)++tmp;
			add(2,tmp);
		}
		for(int i=3;i*i<=a;i+=2)
			if(!(a%i)){
				for(tmp=0;!(a%i);a/=i)++tmp;
				add(i,tmp);
			}
		if(a>1)add(a,1);
	}
	for(int i=1;i<=tot;++i)ans^=SG(set[i]);
	puts(ans?"Mojtaba":"Arpa");
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const int SZ = 1 << 25;
list<int> primes;
int nimber[SZ];
void prec() {
  const int N = 1e5;
  vector<bool> isprime(N, true);
  for (int i = 2; i < N; i++) {
    if (isprime[i]) {
      primes.push_back(i);
      for (int j = 2 * i; j < N; j += i) isprime[j] = false;
    }
  }
  memset(nimber, -1, sizeof nimber);
  nimber[0] = 0;
}

int get(int mask) {
  int val = mask < SZ ? nimber[mask] : -1;
  if (val == -1) {
    set<int> s;
    for (int i = 0; (mask >> i) > 0; i++) {
      int newmask = (mask >> (i + 1)) | (mask & ((1 << i) - 1));
      s.insert(get(newmask));
    }
    for (val = 0; s.find(val) != s.end(); val++);
  }
  if (mask < SZ) nimber[mask] = val;
  return val;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  prec();

  int n; cin >> n;
  map<int, int> masks;
  int answer = 0;
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    for (int p: primes) {
      int j = 0;
      while (x % p == 0) x /= p, j++;
      if (j > 0) masks[p] |= 1 << (j - 1);
    }
    if (x > 1) answer ^= get(1);
  }
  for (auto it: masks) {
    answer ^= get(it.second);
  }
  cout << (answer == 0 ? "Arpa" : "Mojtaba") << '\n';
  return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const int SZ = 1 << 20;
list<int> primes;
int nimber[SZ];
void prec() {
  const int N = 1e5;
  vector<bool> isprime(N, true);
  for (int i = 2; i < N; i++) {
    if (isprime[i]) {
      primes.push_back(i);
      for (int j = 2 * i; j < N; j += i) isprime[j] = false;
    }
  }
  memset(nimber, -1, sizeof nimber);
  nimber[0] = 0;
}

int get(int mask) {
  int val = mask < SZ ? nimber[mask] : -1;
  if (val == -1) {
    set<int> s;
    for (int i = 0; (mask >> i) > 0; i++) {
      s.insert(get((mask >> (i + 1)) | (mask & ((1 << i) - 1))));
    }
    for (val = 0; s.find(val) != s.end(); val++);
  }
  if (mask < SZ) nimber[mask] = val;
  return val;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  prec();

  int n; cin >> n;
  map<int, int> masks;
  int answer = 0;
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    for (int p: primes) {
      int j = 0;
      while (x % p == 0) x /= p, j++;
      if (j > 0) masks[p] |= 1 << (j - 1);
    }
    if (x > 1) answer ^= get(1);
  }
  for (auto it: masks) {
    answer ^= get(it.second);
  }
  cout << (answer == 0 ? "Arpa" : "Mojtaba") << '\n';
  return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const int SZ = 1 << 25;
list<int> primes;
int nimber[SZ];
void prec() {
  const int N = 1e5;
  vector<bool> isprime(N, true);
  for (int i = 2; i < N; i++) {
    if (isprime[i]) {
      primes.push_back(i);
      for (int j = 2 * i; j < N; j += i) isprime[j] = false;
    }
  }
  memset(nimber, -1, sizeof nimber);
  nimber[0] = 0;
}

int get(int mask) {
  int val = mask < SZ ? nimber[mask] : -1;
  if (val == -1) {
    set<int> s;
    for (int i = 0; (mask >> i) > 0; i++) {
      int newmask = (mask >> (i + 1)) | (mask & ((1 << i) - 1));
      s.insert(get(newmask));
    }
    for (val = 0; s.find(val) != s.end(); val++);
  }
  if (mask < SZ) nimber[mask] = val;
  return val;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  prec();

  int n; cin >> n;
  map<int, int> masks;
  set<int> large;
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    for (int p: primes) {
      int j = 0;
      while (x % p == 0) x /= p, j++;
      if (j > 0) masks[p] |= 1 << (j - 1);
    }
    if (x > 1) large.insert(x);
  }
  int answer = large.size() & 1;
  for (auto it: masks) answer ^= get(it.second);
  cout << (answer == 0 ? "Arpa" : "Mojtaba") << '\n';
  return 0;
}


#include<bits/stdc++.h>
template <class T> inline void read(T &x) {
	int t; while (((t = getchar()) < '0' || t > '9') && t != '-') ;
	bool flag = false;
	if (t == '-') flag = true, t = getchar(); x = t - '0';
	while ((t = getchar()) >= '0' && t <= '9') x = x * 10 + (t - '0');
	if (flag) x = -x;
}
using namespace std;
const int maxn = 16;
const int MAXV = 0x3f3f3f3f;
int n, col[maxn], R[maxn], B[maxn]; // col -> (R->0 B->1)
int f[1 << maxn][2][260];
int C[1 << maxn][2];
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	char s[10];
	read(n);
	int maxred = 0, maxblue = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%s%d%d", s, &R[i], &B[i]);
		maxred += max(R[i] - n, 0);
		maxblue += max(B[i] - n, 0);
		R[i] = min(R[i], n);
		B[i] = min(B[i], n);
		col[i] = s[0] != 'R';
	}
	for (int st = 0; st < (1 << n); ++st) {
		for (int j = 0; j < n; ++j) if (st & (1 << j)) {
			++C[st][col[j]];
		}
	}
	memset(f, 0x3f, sizeof f);
	f[0][0][0] = f[0][1][0] = 0;
	for (int st = 0, a, b, c, d, e, x; st < (1 << n) - 1; ++st) {
		for (int i = 0; i < 2; ++i) for (int j = 0; j <= n * n; ++j) if (f[st][i][j] != MAXV) {
			for (int k = 0; k < n; ++k) if (!(st & (1 << k))) {
				x = st | (1 << k);
				if (i) a = j, b = 0;
				else a = 0, b = j;
				c = max(0, R[k] - C[st][0]);
				d = max(0, B[k] - C[st][1]);
				e = max(c - a, d - b);
				a = a + e - c, b = b + e - d;
				if (a == 0) f[x][0][b] = min(f[x][0][b], f[st][i][j] + e);
				else f[x][1][a] = min(f[x][1][a], f[st][i][j] + e);
			}
		}
	}
	int ans = MAXV;
	for (int i = 0, a, b; i < 2; ++i) for (int j = 0; j <= n * n; ++j) {
		if (i == 0) a = 0, b = j;
		else a = j, b = 0;
		ans = min(ans, f[(1 << n) - 1][i][j] + max(maxred - a, maxblue - b));
	}
	ans += n;
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
template <class T> inline void read(T &x) {
	int t; while (((t = getchar()) < '0' || t > '9') && t != '-') ;
	bool flag = false;
	if (t == '-') flag = true, t = getchar(); x = t - '0';
	while ((t = getchar()) >= '0' && t <= '9') x = x * 10 + (t - '0');
	if (flag) x = -x;
}
using namespace std;
typedef pair<int, int> Pii;
const int maxn = 110;
int n, N;
Pii d[maxn * 100];
map<int, int> sg;
int getsg(int w) {
	if (sg.find(w) != sg.end()) return sg[w];
	int cur = 0;
	for (int k = 0, to; w >> k; ++k) {
		to = (w >> (k + 1)) | (w & ((1 << k) - 1));
		cur |= (1 << getsg(to));
	}
	int res = 0;
	while (cur & (1 << res)) ++res;
	return sg[w] = res;
}
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	read(n);
	for (int i = 1, ori, tmp; i <= n; ++i) {
		read(ori), tmp = ori;
		for (int j = 2; j * j <= ori; ++j) {
			int cnt = 0;
			while (tmp % j == 0) tmp /= j, ++cnt;
			if (cnt) d[++N] = Pii(j, cnt);
		}
		if (tmp != 1) d[++N] = Pii(tmp, 1);
	}
	sort(d + 1, d + N + 1);
	sg[0] = 0;
	int sg_all = 0;
	for (int l = 1, r = 1; l <= N; l = ++r) {
		while (r < N && d[r].first == d[r + 1].first) ++r;
		int val = 0;
		for (int i = l; i <= r; ++i) {
			val |= (1 << (d[i].second - 1));
		}
		sg_all ^= getsg(val);
	}
	if (sg_all) puts("Mojtaba");
	else puts("Arpa");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define print(...) printf(__VA_ARGS__), fflush(stdout)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

inline int read()
{
	int c = getchar(), fg = 1, sum = 0;
	while (c < '0' || c > '9') { if (c == '-') fg = -1; c = getchar(); }
	while (c >= '0' && c <= '9') sum = sum * 10 + c - '0', c = getchar();
	return sum * fg;
}

const int oo = 0x3f3f3f3f;

const int maxn = 100;

int N, M;

map<int, int> dict, all;

inline int SG(int x)
{
	if (x == 1) return 0;
	if (dict.count(x)) return dict[x];
	set<int> mex;
	REP(i, 1, 30)
		if (x >> i) mex.insert(SG((x & ((1 << i) - 1)) | (x >> i)));
	dict[x] = 0;
	while (mex.count(dict[x])) ++dict[x];
	return dict[x];
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif
	N = read();
	REP(i, 1, N)
	{
		int x = read();
		REP(j, 2, sqrt(x))
		{
			if (!(x % j))
			{
				int cnt = 0;
				while (!(x % j)) ++cnt, x /= j;
				all[j] |= 1 << cnt;
			}
			if (x > 1) all[x] |= 2;
		}
	}
	int ans = 0;
	for (auto i : all) ans ^= SG(i.y);
	puts(ans ? "Mojtaba" : "Arpa");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define print(...) printf(__VA_ARGS__), fflush(stdout)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

inline int read()
{
	int c = getchar(), fg = 1, sum = 0;
	while (c < '0' || c > '9') { if (c == '-') fg = -1; c = getchar(); }
	while (c >= '0' && c <= '9') sum = sum * 10 + c - '0', c = getchar();
	return sum * fg;
}

const int oo = 0x3f3f3f3f;

const int maxn = 100;

int N, M;

map<int, int> dict, all;

inline int SG(int x)
{
	if (x == 1) return 0;
	if (dict.count(x)) return dict[x];
	set<int> mex;
	int &ret = dict[x];
	REP(i, 1, 30)
		if (x >> i) mex.insert(SG((x & ((1 << i) - 1)) | (x >> i)));
	ret = 0;
	while (mex.count(ret)) ++ret;
	return ret;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif
	N = read();
	REP(i, 1, N)
	{
		int x = read();
		REP(j, 2, int(sqrt(x) + 0.5))
			if (!(x % j))
			{
				int cnt = 0;
				while (!(x % j)) ++cnt, x /= j;
				all[j] |= 1 << cnt;
			}
		if (x > 1) all[x] |= 2;
	}
	int ans = 0;
	for (auto i : all) ans ^= SG(i.y);
	puts(ans ? "Mojtaba" : "Arpa");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define print(...) printf(__VA_ARGS__), fflush(stdout)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

inline int read()
{
	int c = getchar(), fg = 1, sum = 0;
	while (c < '0' || c > '9') { if (c == '-') fg = -1; c = getchar(); }
	while (c >= '0' && c <= '9') sum = sum * 10 + c - '0', c = getchar();
	return sum * fg;
}

const int oo = 0x3f3f3f3f;

const int maxn = 100;

int N, M;

map<int, int> dict, all;

inline int SG(int x)
{
	if (x == 1) return 0;
	if (dict.count(x)) return dict[x];
	set<int> mex;
	REP(i, 1, 30)
		if (x >> i) mex.insert(SG((x & ((1 << i) - 1)) | (x >> i)));
	dict[x] = 0;
	while (mex.count(dict[x])) ++dict[x];
	return dict[x];
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif
	N = read();
	REP(i, 1, N)
	{
		int x = read();
		REP(j, 2, sqrt(x))
		{
			if (!(x % i))
			{
				int cnt = 0;
				while (!(x % i)) ++cnt, x /= i;
				all[i] |= 1 << cnt;
			}
			if (x > 1) all[x] |= 2;
		}
	}
	int ans = 0;
	for (auto i : all) ans ^= SG(i.y);
	puts(ans ? "Mojtaba" : "Arpa");
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i <= i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define print(...) printf(__VA_ARGS__), fflush(stdout)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

inline int read()
{
	int c = getchar(), fg = 1, sum = 0;
	while (c < '0' || c > '9') { if (c == '-') fg = -1; c = getchar(); }
	while (c >= '0' && c <= '9') sum = sum * 10 + c - '0', c = getchar();
	return sum * fg;
}

const int oo = 0x3f3f3f3f;

const int maxn = 100;

int N, M;

map<int, int> dict, all;

inline int SG(int x)
{
	if (x == 1) return 0;
	if (dict.count(x)) return dict[x];
	set<int> mex;
	int &ret = dict[x];
	REP(i, 1, 30)
		if (x >> i) mex.insert(SG((x & ((1 << i) - 1)) | (x >> i)));
	ret = 0;
	while (mex.count(ret)) ++ret;
	return ret;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif
	N = read();
	REP(i, 1, N)
	{
		int x = read();
		REP(j, 2, int(sqrt(x) + 0.5))
			if (!(x % j))
			{
				int cnt = 0;
				while (!(x % j)) ++cnt, x /= j;
				all[j] |= 1 << cnt;
			}
		if (x > 1) all[x] |= 2;
	}
	int ans = 0;
	for (auto i : all) ans ^= (tmp = SG(i.y));
	puts(ans ? "Mojtaba" : "Arpa");
	return 0;
}


//code sourced from kinesis
#include<bits/stdc++.h>
using namespace std;

#define _REP(i,a,b) for(int i = (a) ; i >= (int)(b) ; --i )
#define REP(i,a,b) for(int i = (a) ; i <= (int)(b) ; ++i )
#define UREP(i,u) for(int i = p[(u)] ; i + 1 ; i = edge[i].next)
//iterator: for(int u:x),x is container
#define x(p) (p).first
#define y(p) (p).second
#define pii pair<int,int>
#define mp(x,y) make_pair((x), (y))
#define sign(x) (fabs(x) < eps ? 0 : ((x) > 0 ? 1 : -1))
#define ll long long
#define L7 __int128//1<<7 bit
#define ull unsigned long long
const int inf = 0x3f3f3f3f;
const ll inff = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-9;
#define ri1(x) scanf("%d", &(x))
#define ri2(x,y) scanf("%d%d", &(x), &(y))
#define ri3(x,y,z) scanf("%d%d%d", &(x), &(y), &(z))
#define ri4(a,b,c,d) scanf("%d%d%d%d", &(a), &(b), &(c), &(d))
//#define Debug
#ifdef Debug
#endif // Debug

map<int,vector<int> > mapp1;
map<vector<int>,int> SG;

void gener(vector<int> &vec)
{
    if(!vec.size()) return ;
    sort(vec.begin(),vec.end());
    vector<int>::iterator it = unique(vec.begin(),vec.end());
    vec = vector<int>((vec[0]==0?vec.begin()+1:vec.begin()),it);
}

int p = 0,in[1000000];
int cal(const vector<int>&st,int sp)
{
    if(SG.count(st)) return SG[st];
    int mx = st.back();
    REP(i,1,mx){
        vector<int> vec;
        for(int w:st){
            if(w<i) vec.push_back(w);
            else vec.push_back(w-i);
        }
        gener(vec);
        in[cal(vec,++p)] = sp;
    }
    for(int i=0;;i++) if(in[i]!=sp) return SG[st] = i;
}

bool operator<(const vector<int>&lhs,const vector<int>&rhs)
{
    if(lhs.size()!=rhs.size()) return lhs.size() < rhs.size();
    for(int i=0;i<lhs.size();i++){
        if(lhs[i]!=rhs[i]) return lhs[i] < rhs[i];
    }
    return false;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);//cf,atcoder,nowcoder needn't delete this
    #endif // ONLINE_JUDGE
    int n;
    ri1(n);
    REP(i,1,n){
        int x;ri1(x);
        for(int j=2;j*j<=x;j++){
            if(x%j==0){
                int tnt = 0;
                while(x%j==0) x/=j,tnt++;
                mapp1[j].push_back(tnt);
            }
        }
        if(x!=1) mapp1[x].push_back(1);
    }
    int ans = 0;
    SG[vector<int>(0)] = 0;
    for(pair<int,vector<int> > w:mapp1){
        gener(y(w));
        ans ^= cal(y(w),++p);
    }
    printf("%s\n",ans > 0 ? "Mojtaba" : "Arpa");
    return 0;
}


//code sourced from kinesis
#include<bits/stdc++.h>
using namespace std;

#define _REP(i,a,b) for(int i = (a) ; i >= (int)(b) ; --i )
#define REP(i,a,b) for(int i = (a) ; i <= (int)(b) ; ++i )
#define UREP(i,u) for(int i = p[(u)] ; i + 1 ; i = edge[i].next)
//iterator: for(int u:x),x is container
#define x(p) (p).first
#define y(p) (p).second
#define pii pair<int,int>
#define mp(x,y) make_pair((x), (y))
#define sign(x) (fabs(x) < eps ? 0 : ((x) > 0 ? 1 : -1))
#define ll long long
#define L7 __int128//1<<7 bit
#define ull unsigned long long
const int inf = 0x3f3f3f3f;
const ll inff = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-9;
#define ri1(x) scanf("%d", &(x))
#define ri2(x,y) scanf("%d%d", &(x), &(y))
#define ri3(x,y,z) scanf("%d%d%d", &(x), &(y), &(z))
#define ri4(a,b,c,d) scanf("%d%d%d%d", &(a), &(b), &(c), &(d))
//#define Debug
#ifdef Debug
#endif // Debug

map<int,vector<int> > mapp1;
map<vector<int>,int> SG;

void gener(vector<int> &vec)
{
    if(!vec.size()) return ;
    sort(vec.begin(),vec.end());
    vector<int>::iterator it = unique(vec.begin(),vec.end());
    vec = vector<int>((vec[0]==0?vec.begin()+1:vec.begin()),it);
}

int p = 0,in[1000000];
int cal(const vector<int>&st,int sp)
{
    if(SG.count(st)) return SG[st];
    int mx = st.back();
    vector<int> ans;
    REP(i,1,mx){
        vector<int> vec;
        for(int w:st){
            if(w<i) vec.push_back(w);
            else vec.push_back(w-i);
        }
        gener(vec);
        ans.push_back(cal(vec,++p));
        //in[cal(vec,++p)] = sp;可能会被之后的递归修改
    }
    for(int i=0;i<ans.size();i++) in[ans[i]] = sp;
    for(int i=0;;i++) if(in[i]!=sp) return SG[st] = i;
}

/*
bool operator<(const vector<int>&lhs,const vector<int>&rhs)
{
    if(lhs.size()!=rhs.size()) return lhs.size() < rhs.size();
    for(int i=0;i<lhs.size();i++){
        if(lhs[i]!=rhs[i]) return lhs[i] < rhs[i];
    }
    return false;
}
*/

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);//cf,atcoder,nowcoder needn't delete this
    #endif // ONLINE_JUDGE
    int n;
    ri1(n);
    REP(i,1,n){
        int x;ri1(x);
        for(int j=2;j*j<=x;j++){
            if(x%j==0){
                int tnt = 0;
                while(x%j==0) x/=j,tnt++;
                mapp1[j].push_back(tnt);
            }
        }
        if(x!=1) mapp1[x].push_back(1);
    }
    int ans = 0;
    SG[vector<int>(0)] = 0;
    for(pair<int,vector<int> > w:mapp1){
        gener(y(w));
        ans ^= cal(y(w),++p);
    }
    printf("%s\n",ans > 0 ? "Mojtaba" : "Arpa");
    return 0;
}


//code sourced from kinesis
#include<bits/stdc++.h>
using namespace std;

#define _REP(i,a,b) for(int i = (a) ; i >= (int)(b) ; --i )
#define REP(i,a,b) for(int i = (a) ; i <= (int)(b) ; ++i )
#define UREP(i,u) for(int i = p[(u)] ; i + 1 ; i = edge[i].next)
//iterator: for(int u:x),x is container
#define x(p) (p).first
#define y(p) (p).second
#define pii pair<int,int>
#define mp(x,y) make_pair((x), (y))
#define sign(x) (fabs(x) < eps ? 0 : ((x) > 0 ? 1 : -1))
#define ll long long
#define L7 __int128//1<<7 bit
#define ull unsigned long long
const int inf = 0x3f3f3f3f;
const ll inff = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-9;
#define ri1(x) scanf("%d", &(x))
#define ri2(x,y) scanf("%d%d", &(x), &(y))
#define ri3(x,y,z) scanf("%d%d%d", &(x), &(y), &(z))
#define ri4(a,b,c,d) scanf("%d%d%d%d", &(a), &(b), &(c), &(d))
//#define Debug
#ifdef Debug
#endif // Debug

map<int,vector<int> > mapp1;
map<vector<int>,int> SG;

void gener(vector<int> &vec)
{
    if(!vec.size()) return ;
    sort(vec.begin(),vec.end());
    vector<int>::iterator it = unique(vec.begin(),vec.end());
    vec = vector<int>((vec[0]==0?vec.begin()+1:vec.begin()),it);
}

int p = 0,in[1000000];
int cal(const vector<int>&st,int sp)
{
    if(SG.count(st)) return SG[st];
    int mx = st.back();
    vector<int> ans;
    REP(i,1,mx){
        vector<int> vec;
        for(int w:st){
            if(w<i) vec.push_back(w);
            else vec.push_back(w-i);
        }
        gener(vec);
        ans.push_back(cal(vec,++p));
        //in[cal(vec,++p)] = sp;可能会被之后的递归修改
    }
    for(int i=0;i<ans.size();i++) in[ans[i]] = sp;
    for(int i=0;;i++) if(in[i]!=sp) return SG[st] = i;
}

bool operator<(const vector<int>&lhs,const vector<int>&rhs)
{
    if(lhs.size()!=rhs.size()) return lhs.size() < rhs.size();
    for(int i=0;i<lhs.size();i++){
        if(lhs[i]!=rhs[i]) return lhs[i] < rhs[i];
    }
    return false;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);//cf,atcoder,nowcoder needn't delete this
    #endif // ONLINE_JUDGE
    int n;
    ri1(n);
    REP(i,1,n){
        int x;ri1(x);
        for(int j=2;j*j<=x;j++){
            if(x%j==0){
                int tnt = 0;
                while(x%j==0) x/=j,tnt++;
                mapp1[j].push_back(tnt);
            }
        }
        if(x!=1) mapp1[x].push_back(1);
    }
    int ans = 0;
    SG[vector<int>(0)] = 0;
    for(pair<int,vector<int> > w:mapp1){
        gener(y(w));
        ans ^= cal(y(w),++p);
    }
    printf("%s\n",ans > 0 ? "Mojtaba" : "Arpa");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
map<int,int> SG;
int getSG(int s){
	if(SG.count(s)) return SG[s];
	vector<int> dic;
	int ts=s;
	for(int bit=29;bit>=0;bit--){
		if(ts&(1<<bit)) ts^=(1<<bit);
		if((ts|(s>>(bit+1)))!=s)
			dic.push_back(getSG((ts|(s>>(bit+1)))));
	}
	sort(dic.begin(),dic.end());
	dic.erase(unique(dic.begin(),dic.end()),dic.end());
	for(int i=0;i<(int)dic.size();i++)
		if(i!=dic[i]) return i;
	return (int)dic.size();
}
vector<int> prime;
bool notPrime[100010];
void initPrime(){
	notPrime[0]=notPrime[1]=true;
	for(int i=2;i<=100000;i++){
		if(!notPrime[i]){
			prime.push_back(i);
			for(int j=2*i;j<=100000;j+=i)
				notPrime[j]=true;
		}
	}
}
map<int,int> dic;
void getFac(int x){
	for(int i=0;i<(int)prime.size() && prime[i]<=x;i++){
		if(x%prime[i]==0){
			int cnt=0;
			while(x%prime[i]==0){
				x/=prime[i];
				cnt++;
			}
			dic[prime[i]]|=(1<<(cnt-1));
		}
	}
	if(x>1) dic[x]|=1;
}
int main(){
	initPrime();
	int n,x;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		getFac(x);
	}
	int v=0;
	SG[0]=0;
	for(auto it=dic.begin();it!=dic.end();it++)
		v^=getSG(it->second);
	if(v!=0) puts("Mojtaba");
	else puts("Arpa");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
map<int,int> SG;
int getSG(int s){
	if(SG.count(s)) return SG[s];
	vector<int> dic;
	int ts=s;
	for(int bit=29;bit>=0;bit--){
		if(ts&(1<<bit)) ts^=(1<<bit);
		if((ts|(s>>(bit+1)))!=s)
			dic.push_back(getSG((ts|(s>>(bit+1)))));
	}
	sort(dic.begin(),dic.end());
	dic.erase(unique(dic.begin(),dic.end()),dic.end());
	for(int i=0;i<(int)dic.size();i++)
		if(i!=dic[i]) return SG[s]=i;
	return SG[s]=(int)dic.size();
}
vector<int> prime;
bool notPrime[100010];
void initPrime(){
	notPrime[0]=notPrime[1]=true;
	for(int i=2;i<=100000;i++){
		if(!notPrime[i]){
			prime.push_back(i);
			for(int j=2*i;j<=100000;j+=i)
				notPrime[j]=true;
		}
	}
}
map<int,int> dic;
void getFac(int x){
	for(int i=0;i<(int)prime.size() && prime[i]<=x;i++){
		if(x%prime[i]==0){
			int cnt=0;
			while(x%prime[i]==0){
				x/=prime[i];
				cnt++;
			}
			dic[prime[i]]|=(1<<(cnt-1));
		}
	}
	if(x>1) dic[x]|=1;
}
int main(){
	initPrime();
	int n,x;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		getFac(x);
	}
	int v=0;
	SG[0]=0;
	for(auto it=dic.begin();it!=dic.end();it++)
		v^=getSG(it->second);
	if(v!=0) puts("Mojtaba");
	else puts("Arpa");
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[105];
int sg(int x,int maxn)
{
	while(maxn>0&&(x&(1<<(maxn-1)))==0)maxn--;
	if(maxn==0)return 0;
	bool vis[30]={0};
	for(int i=1;i<=maxn;i++)
	{
		int now=x>>i;
		now|=x&((1<<(i-1))-1);
		vis[sg(now,max(maxn-i,i-1))]=1;
	}
	for(int i=0;;i++)
	if(!vis[i])return i;
}
#define N 30000
int prime[N],tot;
bool mark[N];
void pre()
{
	for(int i=2;i<N;i++)
	{
		if(!mark[i])prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<N;j++)
		{
			mark[i*prime[j]]=1;
			if(!(i%prime[j]))break;
		}
	}
}
int ans;
void solve(int x)
{
	int t=0,maxn=0;
	for(int i=1;i<=n;i++)
	{
		int tmp=a[i],now=0;
		while(tmp%x==0)
		tmp/=x,now++;
		if(now)t|=1<<(now-1);
		maxn=max(maxn,now);
	}
	ans^=sg(t,maxn);
}
int judge(int x)
{
	for(int i=1;i<=tot;i++)
	while(x%prime[i]==0)x/=prime[i];
	return x;
}
int haha,ttt[105];
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		int x=judge(a[i]);
		if(x!=1)ttt[++haha]=x;
	}
	sort(ttt+1,ttt+haha+1);
	for(int l=1,r=1;l<=haha;l=r+1)
	{
		while(r<=haha&&ttt[r+1]==ttt[r])r++;
		ans^=1;
	}
	for(int i=1;i<=tot;i++)
	{
		solve(prime[i]);
	}
//	printf("%d\n",ans);
	puts((!ans)?"Arpa":"Mojtaba");
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[105];
int sg(int s[],int maxn)
{
	if(maxn==0)return 0;
/*	printf("%d: ",maxn);
	for(int i=1;i<=maxn;i++)
	printf("%d ",s[i]);puts("");*/
	bool vis[30]={0};
	for(int i=1;i<=maxn;i++)
	{
		int t[30]={0};
		for(int j=1;j<i;j++)
		t[j]+=s[j];
		for(int j=i;j<=maxn;j++)
		t[j-i]+=s[j];
		int now=maxn;
		while(now&&!t[now])now--;
		vis[sg(t,now)]=1;
	}
	for(int i=0;;i++)
	if(!vis[i])return i;
}
#define N 30000
int prime[N],tot;
bool mark[N];
void pre()
{
	for(int i=2;i<N;i++)
	{
		if(!mark[i])prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<N;j++)
		{
			mark[i*prime[j]]=1;
			if(!(i%prime[j]))break;
		}
	}
}
int ans;
void solve(int x)
{
	int t[30]={0},maxn=0;
	for(int i=1;i<=n;i++)
	{
		int tmp=a[i],now=0;
		while(tmp%x==0)
		tmp/=x,now++;
		t[now]++;
		maxn=max(maxn,now);
	}
	ans^=sg(t,maxn);
}
int judge(int x)
{
	for(int i=1;i<=tot;i++)
	while(x%prime[i]==0)x/=prime[i];
	return x;
}
int haha,ttt[105];
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		int x=judge(a[i]);
		if(x!=1)ttt[++haha]=x;
	}
	sort(ttt+1,ttt+haha+1);
	for(int l=1,r=1;l<=haha;l=r+1)
	{
		while(r<=haha&&ttt[r+1]==ttt[r])r++;
		ans^=1;
	}
	for(int i=1;i<=tot;i++)
	{
		solve(prime[i]);
	}
//	printf("%d\n",ans);
	puts((!ans)?"Arpa":"Mojtaba");
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[105];
int sg(int x)
{
	int maxn=29;
	while(maxn>0&&(x&(1<<(maxn-1)))==0)maxn--;
	if(maxn==0)return 0;
//	printf("%d %d\n",x,maxn);
	bool vis[30]={0};
	for(int i=1;i<maxn;i++)
	{
/*		int t[30]={0};
		for(int j=1;j<i;j++)
		t[j]+=s[j];
		for(int j=i;j<=maxn;j++)
		t[j-i]+=s[j];
		int now=maxn;
		while(now&&!t[now])now--;
		vis[sg(t,now)]=1;*/
		int now=x>>i;
		now|=x&((1<<i)-1);
		vis[sg(now)]=1;
	}
	vis[sg(x^(1<<(maxn-1)))]=1;
	for(int i=0;;i++)
	if(!vis[i])return /*printf("%d %d %d\n",x,maxn,i),*/i;
}
#define N 30000
int prime[N],tot;
bool mark[N];
void pre()
{
	for(int i=2;i<N;i++)
	{
		if(!mark[i])prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<N;j++)
		{
			mark[i*prime[j]]=1;
			if(!(i%prime[j]))break;
		}
	}
}
int ans;
void solve(int x)
{
	int t=0;
	for(int i=1;i<=n;i++)
	{
		int tmp=a[i],now=0;
		while(tmp%x==0)
		tmp/=x,now++;
		if(now)t|=1<<(now-1);
	}
	ans^=sg(t);
}
int judge(int x)
{
	for(int i=1;i<=tot;i++)
	while(x%prime[i]==0)x/=prime[i];
	return x;
}
int haha,ttt[105];
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		int x=judge(a[i]);
		if(x!=1)ttt[++haha]=x;
	}
	sort(ttt+1,ttt+haha+1);
	for(int l=1,r=1;l<=haha;l=r+1)
	{
		while(r<=haha&&ttt[r+1]==ttt[r])r++;
		ans^=1;
	}
	for(int i=1;i<=tot;i++)
	{
		solve(prime[i]);
	}
//	printf("%d\n",ans);
	puts((!ans)?"Arpa":"Mojtaba");
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[105];
int sg(int x)
{
	int maxn=29;
	while(maxn>0&&(x&(1<<(maxn-1)))==0)maxn--;
	if(maxn==0)return 0;
//	printf("%d %d\n",x,maxn);
	bool vis[30]={0};
	for(int i=1;i<=maxn;i++)
	{
/*		int t[30]={0};
		for(int j=1;j<i;j++)
		t[j]+=s[j];
		for(int j=i;j<=maxn;j++)
		t[j-i]+=s[j];
		int now=maxn;
		while(now&&!t[now])now--;
		vis[sg(t,now)]=1;*/
		int now=x>>i;
		now|=x&((1<<(i-1))-1);
		vis[sg(now)]=1;
	}
//	vis[sg(x^(1<<(maxn-1)))]=1;
	for(int i=0;;i++)
	if(!vis[i])return /*printf("%d %d %d\n",x,maxn,i),*/i;
}
#define N 30000
int prime[N],tot;
bool mark[N];
void pre()
{
	for(int i=2;i<N;i++)
	{
		if(!mark[i])prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<N;j++)
		{
			mark[i*prime[j]]=1;
			if(!(i%prime[j]))break;
		}
	}
}
int ans;
void solve(int x)
{
	int t=0;
	for(int i=1;i<=n;i++)
	{
		int tmp=a[i],now=0;
		while(tmp%x==0)
		tmp/=x,now++;
		if(now)t|=1<<(now-1);
	}
	ans^=sg(t);
}
int judge(int x)
{
	for(int i=1;i<=tot;i++)
	while(x%prime[i]==0)x/=prime[i];
	return x;
}
int haha,ttt[105];
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		int x=judge(a[i]);
		if(x!=1)ttt[++haha]=x;
	}
	sort(ttt+1,ttt+haha+1);
	for(int l=1,r=1;l<=haha;l=r+1)
	{
		while(r<=haha&&ttt[r+1]==ttt[r])r++;
		ans^=1;
	}
	for(int i=1;i<=tot;i++)
	{
		solve(prime[i]);
	}
//	printf("%d\n",ans);
	puts((!ans)?"Arpa":"Mojtaba");
}


#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[105];
map<int,int>mp;
int sg(int x,int maxn)
{
	if(mp.find(x)!=mp.end())return mp[x];
	while(maxn>0&&(x&(1<<(maxn-1)))==0)maxn--;
	if(maxn==0)return 0;
	bool vis[30]={0};
	for(int i=1;i<=maxn;i++)
	{
		int now=x>>i;
		now|=x&((1<<(i-1))-1);
		vis[sg(now,max(maxn-i,i-1))]=1;
	}
	for(int i=0;;i++)
	if(!vis[i])return mp[x]=i;
}
#define N 30000
int prime[N],tot;
bool mark[N];
void pre()
{
	for(int i=2;i<N;i++)
	{
		if(!mark[i])prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<N;j++)
		{
			mark[i*prime[j]]=1;
			if(!(i%prime[j]))break;
		}
	}
}
int ans;
void solve(int x)
{
	int t=0,maxn=0;
	for(int i=1;i<=n;i++)
	{
		int tmp=a[i],now=0;
		while(tmp%x==0)
		tmp/=x,now++;
		if(now)t|=1<<(now-1);
		maxn=max(maxn,now);
	}
	ans^=sg(t,maxn);
}
int judge(int x)
{
	for(int i=1;i<=tot;i++)
	while(x%prime[i]==0)x/=prime[i];
	return x;
}
int haha,ttt[105];
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		int x=judge(a[i]);
		if(x!=1)ttt[++haha]=x;
	}
	sort(ttt+1,ttt+haha+1);
	for(int l=1,r=1;l<=haha;l=r+1)
	{
		while(r<=haha&&ttt[r+1]==ttt[r])r++;
		ans^=1;
	}
	for(int i=1;i<=tot;i++)
	{
		solve(prime[i]);
	}
//	printf("%d\n",ans);
	puts((!ans)?"Arpa":"Mojtaba");
}


#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[105];
map<int,int>mp;
int sg(int x,int maxn)
{
	if(mp.find(x)!=mp.end())return mp[x];
	while(maxn>0&&(x&(1<<(maxn-1)))==0)maxn--;
	if(maxn==0)return 0;
	bool vis[30]={0};
	for(int i=1;i<=maxn;i++)
	{
		int now=x>>i;
		now|=x&((1<<(i-1))-1);
		vis[sg(now,max(maxn-i,i-1))]=1;
	}
	for(int i=0;;i++)
	if(!vis[i])return mp[x]=i;
}
int ans;
void solve(int x)
{
	int t=0,maxn=0;
	for(int i=1;i<=n;i++)
	{
		int tmp=a[i],now=0;
		while(tmp%x==0)
		tmp/=x,now++;
		if(now)t|=1<<(now-1);
		maxn=max(maxn,now);
	}
	ans^=sg(t,maxn);
}
int top,s[1000000];
void judge(int x)
{
	for(int i=2;i*i<=x;i++)
	if(x%i==0)
	{
		s[++top]=i;
		while(x%i==0)x/=i;
	}
	if(x>1)s[++top]=x;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		judge(a[i]);
	}
	sort(s+1,s+top+1);
	for(int i=1;i<=top;i++)if(s[i]!=s[i-1])
	{
		solve(s[i]);
	}
	puts((!ans)?"Arpa":"Mojtaba");
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#define N 1000005
#define M 31
#define LL long long
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
#define FD(a, b, c) for(int a = (b); a >= (c); a--)
using namespace std;

int n, p, ans;
map<int, int> ind;
vector<int> v[1005], tmp;

int t[N][M], w[N], tt, cs, seq[N][M], ls[N], dp[N], cnt[M];

int get(vector<int> &x){
	int r = 0, len = x.size();
	fi(i, 0, len){
		if(!t[r][x[i]]) t[r][x[i]] = ++tt;
		r = t[r][x[i]];
	}

	if(!w[r]){
		w[r] = ++cs;
		ls[cs] = len;
		fi(i, 0, len) seq[cs][i] = x[i];
		dp[cs] = -1;
	}

	return w[r];
}

int go(int id){
	if(dp[id] > -1) return dp[id];

	bool used[M];
	fi(i, 0, M) used[i] = 0;

	int mx = seq[id][ls[id] - 1];

	FI(i, 1, mx){
		fi(j, 0, M) cnt[j] = 0;

		fi(j, 0, ls[id]){
			if(seq[id][j] > i)
				cnt[seq[id][j] - i] = 1;
			else if(seq[id][j] < i)
				cnt[seq[id][j]] = 1;
		}

		tmp.clear();
		fi(j, 0, M) if(cnt[j]) tmp.push_back(j);

		int nid = get(tmp);
		used[go(nid)] = 1;
	}

	fi(i, 0, M) if(!used[i]){
		dp[id] = i;
		break;
	}

	return dp[id];
}

int main(){
	scanf("%d", &n);
	fi(i, 0, n){
		int a;
		scanf("%d", &a);

		for(int i = 2; i * i <= a; i++){
			if(a % i == 0){
				int cnt = 0;
				while(a % i == 0){
					cnt++;
					a /= i;
				}
				if(!ind[i]) ind[i] = ++p;
				v[ind[i]].push_back(cnt);
			}
		}

		if(a > 1){
			if(!ind[a]) ind[a] = ++p;
			v[ind[a]].push_back(1);
		}
	}

	int zero = get(v[0]);
	dp[zero] = 0;

	FI(i, 1, p){
		sort(v[i].begin(), v[i].end());
		v[i].resize(unique(v[i].begin(), v[i].end()) - v[i].begin());
		int l = v[i].size();

		int id = get(v[i]);
		ans ^= go(id);
	}

	puts(ans ? "Mojtaba" : "Arpa");
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#define N 1000005
#define M 31
#define LL long long
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
#define FD(a, b, c) for(int a = (b); a >= (c); a--)
using namespace std;

int n, p, ans;
map<int, int> ind;
vector<int> v[105], tmp;

int t[N][M], w[N], tt, cs, seq[N][M], ls[N], dp[N], cnt[M];

int get(vector<int> &x){
	int r = 0, len = x.size();
	fi(i, 0, len){
		if(!t[r][x[i]]) t[r][x[i]] = ++tt;
		r = t[r][x[i]];
	}

	if(!w[r]){
		w[r] = ++cs;
		ls[cs] = len;
		fi(i, 0, len) seq[cs][i] = x[i];
		dp[cs] = -1;
	}

	return w[r];
}

int go(int id){
	if(dp[id] > -1) return dp[id];

	bool used[M];
	fi(i, 0, M) used[i] = 0;

	int mx = seq[id][ls[id] - 1];

	FI(i, 1, mx){
		fi(j, 0, M) cnt[j] = 0;

		fi(j, 0, ls[id]){
			if(seq[id][j] > i)
				cnt[seq[id][j] - i] = 1;
			else if(seq[id][j] < i)
				cnt[seq[id][j]] = 1;
		}

		fi(j, 0, M) if(cnt[j]) tmp.push_back(j);

		int nid = get(tmp);
		used[go(nid)] = 1;
	}

	fi(i, 0, M) if(!used[i]){
		dp[id] = i;
		break;
	}

	return dp[id];
}

int main(){
	scanf("%d", &n);
	fi(i, 0, n){
		int a;
		scanf("%d", &a);

		for(int i = 2; i * i <= a; i++){
			if(a % i == 0){
				int cnt = 0;
				while(a % i == 0){
					cnt++;
					a /= i;
				}
				if(!ind[i]) ind[i] = ++p;
				v[ind[i]].push_back(cnt);
			}
		}

		if(a > 1){
			if(!ind[a]) ind[a] = ++p;
			v[ind[a]].push_back(1);
		}
	}

	int zero = get(v[0]);
	dp[zero] = 0;

	FI(i, 1, p){
		sort(v[i].begin(), v[i].end());
		v[i].resize(unique(v[i].begin(), v[i].end()) - v[i].begin());
		int l = v[i].size();

		int id = get(v[i]);
		ans ^= go(id);
	}

	puts(ans ? "Mojtaba" : "Arpa");
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#define N 1000005
#define M 31
#define LL long long
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
#define FD(a, b, c) for(int a = (b); a >= (c); a--)
using namespace std;

int n, p, ans;
map<int, int> ind;
vector<int> v[105], tmp;

int t[N][M], w[N], tt, cs, seq[N][M], ls[N], dp[N], cnt[M];

int get(vector<int> &x){
	int r = 0, len = x.size();
	fi(i, 0, len){
		if(!t[r][x[i]]) t[r][x[i]] = ++tt;
		r = t[r][x[i]];
	}

	if(!w[r]){
		w[r] = ++cs;
		ls[cs] = len;
		fi(i, 0, len) seq[cs][i] = x[i];
		dp[cs] = -1;
	}

	return w[r];
}

int go(int id){
	if(dp[id] > -1) return dp[id];

	bool used[M];
	fi(i, 0, M) used[i] = 0;

	int mx = seq[id][ls[id] - 1];

	FI(i, 1, mx){
		fi(j, 0, M) cnt[j] = 0;

		fi(j, 0, ls[id]){
			if(seq[id][j] > i)
				cnt[seq[id][j] - i] = 1;
			else if(seq[id][j] < i)
				cnt[seq[id][j]] = 1;
		}

		tmp.clear();
		fi(j, 0, M) if(cnt[j]) tmp.push_back(j);

		int nid = get(tmp);
		used[go(nid)] = 1;
	}

	fi(i, 0, M) if(!used[i]){
		dp[id] = i;
		break;
	}

	return dp[id];
}

int main(){
	scanf("%d", &n);
	fi(i, 0, n){
		int a;
		scanf("%d", &a);

		for(int i = 2; i * i <= a; i++){
			if(a % i == 0){
				int cnt = 0;
				while(a % i == 0){
					cnt++;
					a /= i;
				}
				if(!ind[i]) ind[i] = ++p;
				v[ind[i]].push_back(cnt);
			}
		}

		if(a > 1){
			if(!ind[a]) ind[a] = ++p;
			v[ind[a]].push_back(1);
		}
	}

	int zero = get(v[0]);
	dp[zero] = 0;

	FI(i, 1, p){
		sort(v[i].begin(), v[i].end());
		v[i].resize(unique(v[i].begin(), v[i].end()) - v[i].begin());
		int l = v[i].size();

		int id = get(v[i]);
		ans ^= go(id);
	}

	puts(ans ? "Mojtaba" : "Arpa");
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#define N 1005
#define M 33
#define LL long long
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
#define FD(a, b, c) for(int a = (b); a >= (c); a--)
using namespace std;

int n, p, dp[N], ans;
map<int, int> ind;
vector<int> v[N], tmp;

int main(){
	scanf("%d", &n);
	fi(i, 0, n){
		int a;
		scanf("%d", &a);

		for(int i = 2; i * i <= a; i++){
			if(a % i == 0){
				int cnt = 0;
				while(a % i == 0){
					cnt++;
					a /= i;
				}
				if(!ind[i]) ind[i] = ++p;
				v[ind[i]].push_back(cnt);
			}
		}

		if(a > 1){
			if(!ind[a]) ind[a] = ++p;
			v[ind[a]].push_back(1);
		}
	}

	FI(i, 1, p){
		sort(v[i].begin(), v[i].end());
		int l = v[i].size();
		int x = v[i][l - 1];

		dp[x] = 0;
		bool u[M];

		FD(val, x - 1, 0){
			int can;
			fi(j, 0, l) if(v[i][j] > val){
				can = v[i][j] - val;
				break;
			}

			FI(j, 0, M - 1) u[j] = 0;
			FI(j, 1, can) u[dp[val + j]] = 1;

			FI(j, 0, M - 1) if(!u[j]){
				dp[val] = j;
				break;
			}
		}

		ans ^= dp[0];
	}

	puts(ans ? "Mojtaba" : "Arpa");
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#define N 1000005
#define M 31
#define LL long long
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
#define FD(a, b, c) for(int a = (b); a >= (c); a--)
using namespace std;

int n, p, ans;
map<int, int> ind;
vector<int> v[105], tmp;

int t[N][M], w[N], tt, cs, seq[N][M], ls[N], dp[N];

int get(vector<int> &x){
	int r = 0, len = x.size();
	fi(i, 0, len){
		if(!t[r][x[i]]) t[r][x[i]] = ++tt;
		r = t[r][x[i]];
	}

	if(!w[r]){
		w[r] = ++cs;
		ls[cs] = len;
		fi(i, 0, len) seq[cs][i] = x[i];
		dp[cs] = -1;
	}

	return w[r];
}

int go(int id){
	if(dp[id] > -1) return dp[id];

	bool used[M];
	fi(i, 0, M) used[i] = 0;

	int mx = seq[id][ls[id] - 1];

	FI(i, 1, mx){
		tmp.clear();
		fi(j, 0, ls[id]){
			if(seq[id][j] > i)
				tmp.push_back(seq[id][j] - i);
			else if(seq[id][j] < i)
				tmp.push_back(seq[id][j]);
		}

		sort(tmp.begin(), tmp.end());
		tmp.resize(unique(tmp.begin(), tmp.end()) - tmp.begin());

		int nid = get(tmp);
		used[go(nid)] = 1;
	}

	fi(i, 0, M) if(!used[i]){
		dp[id] = i;
		break;
	}

	return dp[id];
}

int main(){
	scanf("%d", &n);
	fi(i, 0, n){
		int a;
		scanf("%d", &a);

		for(int i = 2; i * i <= a; i++){
			if(a % i == 0){
				int cnt = 0;
				while(a % i == 0){
					cnt++;
					a /= i;
				}
				if(!ind[i]) ind[i] = ++p;
				v[ind[i]].push_back(cnt);
			}
		}

		if(a > 1){
			if(!ind[a]) ind[a] = ++p;
			v[ind[a]].push_back(1);
		}
	}

	int zero = get(v[0]);
	dp[zero] = 0;

	FI(i, 1, p){
		sort(v[i].begin(), v[i].end());
		v[i].resize(unique(v[i].begin(), v[i].end()) - v[i].begin());
		int l = v[i].size();

		int id = get(v[i]);
		ans ^= go(id);
	}

	puts(ans ? "Mojtaba" : "Arpa");
}


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

map<int,int> HASH;
int calc(int now){
	if (HASH.count(now)) return HASH[now];
	set<int> mex;
	int MX=0,i,j;
	REP(i,30) if (now&(1<<i)) MX=max(MX,i);
	FOR(i,1,MX){
		int down=0;
		REP(j,30) if (now&(1<<j)){
			if (j==i) continue;
			if (j>i) down|=1<<(j-i);
			else down|=1<<j;
		}
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
	return HASH[now]=ret;
}
int cnt;
int n,k;
int i,j;
int ans;
int val[maxn];
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]]|=1<<tot;
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]]|=1<<1;
		}
	}
	FOR(i,1,cnt) ans^=calc(val[i]);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

int n,k;
int i,j;
int ans;
vector<int> val[maxn];
int calc(vector<int> now){
	set<int> mex;
	int MX=0;
	for (int val:now) MX=max(MX,val);
	for (int val:now) printf("%d ",val);puts("");
	FOR(i,1,MX){
		vector<int> down;
		for (int val:now){
			if (val==i) continue;
			if (val>i) down.push_back(val-i);
			else down.push_back(val);
		}
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
	for (int val:now) printf("%d ",val);printf(", ret=%d",ret);puts("");
	return ret;
}
int cnt;
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]].push_back(tot);
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]].push_back(1);
		}
	}
//	FOR(i,1,100000) sort(val[i].begin(),val[i].end()),val[i].erase(unique(val[i].begin(),val[i].end()),val[i].end());
	FOR(i,1,cnt) if (val[i].size()) ans^=calc(val[i]);
//	printf("%d\n",ans);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

int n,k;
int i,j;
int ans;
vector<int> val[maxn];
int calc(vector<int> now){
	set<int> mex;
	int MX=0;
	for (int val:now) MX=max(MX,val);
//	for (int val:now) printf("%d ",val);puts("");
	FOR(i,1,MX){
		vector<int> down;
		for (int val:now){
			if (val==i) continue;
			if (val>i) down.push_back(val-i);
			else down.push_back(val);
		}
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
//	for (int val:now) printf("%d ",val);printf(", ret=%d",ret);puts("");
	return ret;
}
int cnt;
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]].push_back(tot);
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]].push_back(1);
		}
	}
//	FOR(i,1,100000) sort(val[i].begin(),val[i].end()),val[i].erase(unique(val[i].begin(),val[i].end()),val[i].end());
	FOR(i,1,cnt) if (val[i].size()) ans^=calc(val[i]);
//	printf("%d\n",ans);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}
//MDZZ忘写HASH了
map<vector<int>,int> HASH;
int calc(vector<int> now){
	if (HASH.count(now)) return HASH[now];
	set<int> mex;
	int MX=0,i;
	for (int val:now) MX=max(MX,val);
//	for (int val:now) printf("%d ",val);puts("");
	FOR(i,1,MX){
		vector<int> down;
		for (int val:now){
			if (val==i) continue;
			if (val>i) down.push_back(val-i);
			else down.push_back(val);
		}
		sort(down.begin(),down.end());
		down.erase(unique(down.begin(),down.end()),down.end());
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
//	for (int val:now) printf("%d ",val);printf(", ret=%d",ret);puts("");
	return HASH[now]=ret;
}
int cnt;
int n,k;
int i,j;
int ans;
vector<int> val[maxn];
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]].push_back(tot);
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]].push_back(1);
		}
	}
	FOR(i,1,cnt) sort(val[i].begin(),val[i].end()),val[i].erase(unique(val[i].begin(),val[i].end()),val[i].end());
	FOR(i,1,cnt) if (val[i].size()) ans^=calc(val[i]);
//	printf("%d\n",ans);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

int calc(vector<int> now){
	set<int> mex;
	int MX=0,i;
	for (int val:now) MX=max(MX,val);
//	for (int val:now) printf("%d ",val);puts("");
	FOR(i,1,MX){
		vector<int> down;
		for (int val:now){
			if (val==i) continue;
			if (val>i) down.push_back(val-i);
			else down.push_back(val);
		}
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
//	for (int val:now) printf("%d ",val);printf(", ret=%d",ret);puts("");
	return ret;
}
int n,k;
int i,j;
int ans;
vector<int> val[maxn];
int cnt;
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]].push_back(tot);
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]].push_back(1);
		}
	}
//	FOR(i,1,100000) sort(val[i].begin(),val[i].end()),val[i].erase(unique(val[i].begin(),val[i].end()),val[i].end());
	FOR(i,1,cnt) if (val[i].size()) ans^=calc(val[i]);
//	printf("%d\n",ans);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

map<vector<int>,int> HASH;
int calc(vector<int> now){
	if (HASH.count(now)) return HASH[now];
	set<int> mex;
	int MX=0,i;
	for (int val:now) MX=max(MX,val);
//	for (int val:now) printf("%d ",val);puts("");
	FOR(i,1,MX){
		vector<int> down;
		for (int val:now){
			if (val==i) continue;
			if (val>i) down.push_back(val-i);
			else down.push_back(val);
		}
		sort(down.begin(),down.end());
		down.erase(unique(down.begin(),down.end()),down.end());
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
//	for (int val:now) printf("%d ",val);printf(", ret=%d",ret);puts("");
	return ret;
}
int cnt;
int n,k;
int i,j;
int ans;
vector<int> val[maxn];
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]].push_back(tot);
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]].push_back(1);
		}
	}
	FOR(i,1,cnt) sort(val[i].begin(),val[i].end()),val[i].erase(unique(val[i].begin(),val[i].end()),val[i].end());
	FOR(i,1,cnt) if (val[i].size()) ans^=calc(val[i]);
//	printf("%d\n",ans);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <utility>
using namespace std;
#define REP(I,N) for (I=0;I<N;I++)
#define rREP(I,N) for (I=N-1;I>=0;I--)
#define rep(I,S,N) for (I=S;I<N;I++)
#define rrep(I,S,N) for (I=N-1;I>=S;I--)
#define FOR(I,S,N) for (I=S;I<=N;I++)
#define rFOR(I,S,N) for (I=N;I>=S;I--)
typedef unsigned long long ULL;
typedef long long LL;
const int INF=0x3f3f3f3f;
const LL INFF=0x3f3f3f3f3f3f3f3fll;
const LL M=1e9+7;
const LL maxn=1e5+7;
const double eps=0.00000001;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<typename T>inline T powMM(T a,T b){T ret=1;for (;b;b>>=1ll,a=a*a%M) if (b&1) ret=1ll*ret*a%M;return ret;}

map<int,int> HASH;
int calc(int now){
	if (HASH.count(now)) return HASH[now];
	set<int> mex;
	int MX=0,i,j;
	REP(i,30) if (now&(1<<i)) MX=max(MX,i);
	FOR(i,1,MX){
		int down=0;
		REP(j,30) if (now&(1<<j)){
			if (j==i) continue;
			if (j>i) down|=1<<(j-i);
			else down|=1<<j;
		}
		mex.insert(calc(down));
	}
	int ret=0;
	while (mex.count(ret)) ret++;
	return ret;
}
int cnt;
int n,k;
int i,j;
int ans;
int val[maxn];
map<int,int> MP;//val,pos
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d",&k);
		for(j=2;j*j<=k;j++){
			int tot=0;
			while (k%j==0) k/=j,tot++;
			if (tot){
				if (!MP.count(j)) MP[j]=++cnt;
				val[MP[j]]|=1<<tot;
			}
		}if (k!=1){
			if (!MP.count(k)) MP[k]=++cnt;
			val[MP[k]]|=1<<1;
		}
	}
	FOR(i,1,cnt) ans^=calc(val[i]);
	if (ans) puts("Mojtaba");
	else puts("Arpa");
}
/*
*/


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++)
		if(prime[i])
			for(int j=2*i;j<N;j+=i) prime[j]=0;
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(aux.size()==0) return 0;
	if(memo.count(aux)) return memo[aux];
	vi M;
	set<int> jafoi;
	for(int x: aux){
		int conta=x;
		while(!jafoi.count(conta) and conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
					cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			jafoi.insert(conta);
			conta--;
			M.pb(mex(cu));
		}
	}
	sort(M.begin(), M.end());
	int cont=0;
	while(true){
		if(!binary_search(M.begin(),M.end(), cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot){
		r^= mex(x.second);
	}
	db(r);
	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<40;i++){
		if(prime[i]){
			for(int j=2*i;j<N;j+=i) prime[j]=0;
		}
	}
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(aux.size()==0) return 0;
	if(memo.count(aux)) return memo[aux];
	set<int> M;
	set<int> jafoi;
	for(int x: aux){
		int conta=x;
		while(conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
						cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			//jafoi.insert(conta);
			M.insert(mex(cu));
			conta--;
		}
	}
	int cont=0;
	while(true){
		if(!M.count(cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot)
		for(int y: x.second)
			r^=mex(x.second);

	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e6+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++){
		if(prime[i]){
			for(int j=2*i;j<N;j+=i) prime[j]=0;
		}
	}
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(memo.count(aux)) return memo[aux];
	set<int> M;
	for(int x: aux){
		int conta=x;
		while(conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
						cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			M.insert(mex(cu));
			conta--;
		}
	}
	int cont=0;
	while(true){
		if(!M.count(cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot)
		for(int y: x.second)
			r^=mex(x.second);

	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++)
		if(prime[i])
			for(int j=2*i;j<N;j+=i) prime[j]=0;
}
vi get_div(int x){
	vi ret;
	int aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;
int mex(set<int> &aux){
	if(aux.size()==0) return 0;
	if(memo.count(aux)) return memo[aux];
	vi M;
	set<int> jafoi;
	for(int x: aux){
		int conta=x;
		while(!jafoi.count(conta) and conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
						cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			jafoi.insert(conta);
			conta--;
			M.pb(mex(cu));
		}
	}
	sort(M.begin(), M.end());
	int cont=0;
	while(true){
		if(!binary_search(M.begin(),M.end(), cont)) return memo[aux] = cont;
		cont++;
	}
	return 0;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot){
		for(int y: x.second){
			r^=mex(x.second);
		}
	}
	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e6+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++){
		if(prime[i]){
			for(int j=2*i;j<N;j+=i) prime[j]=0;
		}
	}
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(aux%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(memo.count(aux)) return memo[aux];
	set<int> M;
	for(int x: aux){
		int conta=x;
		while(conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
						cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			M.insert(mex(cu));
			conta--;
		}
	}
	int cont=0;
	while(true){
		if(!M.count(cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot)
		for(int y: x.second)
			r^=mex(x.second);

	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++)
		if(prime[i])
			for(int j=2*i;j<N;j+=i) prime[j]=0;
}
vi get_div(int x){
	vi ret;
	int aux=x;
	for(ll i=2;i*i<=aux;i++)
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	if(x>1) ret.pb(x);
	return ret;
}
map<int,int> pot;
int main()
{
	int n;
	sc(n);
	int r=0;
	for(int i=0;i<n;i++){
		int x;
		sc(x);
		vi v= get_div(x);
		int qnt=0;
		int last=-1;
		for(int x: v){
			if(x!=last and last!=-1){
				pot[last] = max(pot[last], qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last] = max(pot[last], qnt);
		}
	}
	for(ii x: pot){
		r^=x.second;
	}
	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++)
		if(prime[i])
			for(int j=2*i;j<N;j+=i) prime[j]=0;
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(aux.size()==0) return 0;
	if(memo.count(aux)) return memo[aux];
	vi M;
	set<int> jafoi;
	for(int x: aux){
		int conta=x;
		while(!jafoi.count(conta) and conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
					cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			jafoi.insert(conta);
			conta--;
			M.pb(mex(cu));
		}
	}
	sort(M.begin(), M.end());
	int cont=0;
	while(true){
		if(!binary_search(M.begin(),M.end(), cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot){
			r^=mex(x.second);
	}
	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<N;i++)
		if(prime[i])
			for(int j=2*i;j<N;j+=i) prime[j]=0;
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(aux.size()==0) return 0;
	if(memo.count(aux)) return memo[aux];
	vi M;
	set<int> jafoi;
	for(int x: aux){
		int conta=x;
		while(!jafoi.count(conta) and conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
						cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			jafoi.insert(conta);
			conta--;
			M.pb(mex(cu));
		}
	}
	sort(M.begin(), M.end());
	int cont=0;
	while(true){
		if(!binary_search(M.begin(),M.end(), cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot){
		for(int y: x.second){
			r^=mex(x.second);
		}
	}
	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N=1e5+10;
int prime[N];
void sieve()
{
	for(int i=0;i<N;i++) prime[i]=1;
	prime[1]=prime[0]=0;
	for(int i=2;i<40;i++){
		if(prime[i]){
			for(int j=2*i;j<N;j+=i) prime[j]=0;
		}
	}
}
vi get_div(int x){
	vi ret;
	ll aux=x;
	for(ll i=2;i*i<=aux;i++){
		while(x%i==0 and prime[i]){
			x/=i;
			ret.pb(i);
		}
	}
	if(x>1) ret.pb(x);
	sort(ret.begin(),ret.end());
	return ret;
}
map<int,set<int> > pot;
map< set<int>, int> memo;

int mex(set<int> &aux){
	if(aux.size()==0) return 0;
	if(memo.count(aux)) return memo[aux];
	set<int> M;
	set<int> jafoi;
	for(int x: aux){
		int conta=x;
		while(conta>0){
			set<int> cu;
			for(int y: aux){
				if(conta<y){
						cu.insert(y-conta);
				}else if(conta>y){
					cu.insert(y);
				}
			}
			jafoi.insert(conta);
			M.insert(mex(cu));
		}
	}
	int cont=0;
	while(true){
		if(!M.count(cont)) break;
		cont++;
	}
	return memo[aux] = cont;
}
int main()
{
	int n;
	sc(n);
	sieve();
	for(int i=0;i<n;i++){
		int y;
		sc(y);
		vi v= get_div(y);
		int qnt=0;
		int last=-1;
		for(int &x: v){
			if(x!=last and last!=-1){
				pot[last].insert(qnt);
				last=x;
				qnt=1;
			}else{
				last=x;
				qnt++;
			}
		}
		if(last!=-1){
			pot[last].insert(qnt);
		}
	}
	int r=0;
	for(auto x: pot)
		for(int y: x.second)
			r^=mex(x.second);

	if(r){
		puts("Mojtaba");
	}else{
		puts("Arpa");
	}
	return 0;
}


#define DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define endl "\n"

#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }

#ifdef DEBUG
    #define dbg(s) {s;}
#endif

#ifndef DEBUG
    #define dbg(s)
#endif

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { // from [0, x-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

#define int ll
#define i32 int32_t

#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update>

#define all(v) (v).begin(),(v).end()

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;

int getInt () {
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}

ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 1e6 + 7;

const ll inf = 1e9 + 7;
map<int, vector<int>> v;
map<vector<int>, int> w;

int solve(vector<int> v){
    sort(all(v));
    v.resize(distance(v.begin(),unique(all(v))));
    if(!v.empty() && v.front() == 0) v.erase(v.begin());

    if (w.count(v) || v.empty()){
        return w[v];
    }
    bool ok = 0;
    vector<int> q, f;
    for (int x = 1; x <= v[v.size()-1]; x++){
        q = v;
        for (int &y : q){
            if (y >= x){
                y -= x;
            }
        }
        f.pb(solve(q));
    }
    int mex = 0;
    sort(all(f));
    for (int x : f){
        if (x == mex) mex++;
    }
    return w[v] = mex;
}

void addNum(int x)
{
    int p;
    for(int i=2;i*i<=x;i++)
    {
        p = 0;
        while(x%i==0)
        {
            p++;
            x/=i;
        }
        if(p==0)
            continue;
        v[i].pb(p);
    }

    if(x>1)
    {
        v[x].pb(1);
    }

}

i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);

    IOS;
    //memset(dp,-1,sizeof(dp));
    //dp[0][0] = 0;
    //precomp();
    int n;
    cin>>n;

    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        addNum(x);
    }

    int ans = 0;
    vector<int> d;
    for(auto p:v)
    {
        //cout<<v<<" "<<mini[v]<<" "<<maxi[v]<<" "<<dp[mini[v]][maxi[v]]<<endl;
        //ans = ans ^ dp[mini[v]][maxi[v]];
        //d = p.S;
        //sort(all(d));
        //d.resize(distance(d.begin(),unique(all(d))));

        ans ^= solve(p.S);
        //cout<<p.F<<" "<<solve(p.S)<<endl;
    }

    if(ans==0)
    {
        cout<<"Arpa"<<endl;
    }
    else
    {
        cout<<"Mojtaba"<<endl;
    }
}


#define DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define endl "\n"

#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }

#ifdef DEBUG
    #define dbg(s) {s;}
#endif

#ifndef DEBUG
    #define dbg(s)
#endif

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { // from [0, x-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

#define int ll
#define i32 int32_t

#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update>

#define all(v) (v).begin(),(v).end()

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;

int getInt () {
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}

ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 1e6 + 7;

const ll inf = 1e9 + 7;

int dp[30][30];

void calc(int mini, int maxi)
{
    vector<int> mex;
    int nexx,nexy;
    for(int i=1;i<=maxi;i++)
    {
        nexx = maxi - i;
        nexy = mini;
        if(i<=mini)
            nexy-=i;
        mex.pb(dp[nexx][nexy]);
    }

    sort(all(mex));
    mex.resize(distance(mex.begin(),unique(all(mex))));

    int ans  = 0;
    while(ans<mex.size() && mex[ans]==ans)
        ans++;
    dp[mini][maxi] = ans;
    dp[maxi][mini] = ans;

    //cout<<mini<<" "<<maxi<<" "<<ans<<endl;
}

void precomp()
{
    for(int maxi=0;maxi<30;maxi++)
    {
        for(int mini=0;mini<=maxi;mini++)
        {
            calc(mini,maxi);
        }
    }
}

map<int,int> mini;
map<int,int> maxi;
set<int> primes;

void addNum(int x)
{
    int p;
    for(int i=2;i*i<=x;i++)
    {
        p = 0;
        while(x%i==0)
        {
            p++;
            x/=i;
        }
        if(p==0)
            continue;
        primes.insert(i);
        if(mini[i]==0)
            mini[i]=p;

        mini[i] = min(mini[i],p);
        maxi[i] = max(maxi[i],p);
    }

    if(x>1)
    {
        primes.insert(x);
        if(mini[x]==0)
            mini[x]=1ll;

        mini[x] = min(mini[x],1ll);
        maxi[x] = max(maxi[x],1ll);

    }

}

i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);

    IOS;
    //memset(dp,-1,sizeof(dp));
    //dp[0][0] = 0;
    precomp();
    int n;
    cin>>n;

    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        addNum(x);
    }

    int ans = 0;
    for(auto v:primes)
    {
        //cout<<v<<" "<<mini[v]<<" "<<maxi[v]<<endl;
        ans = ans ^ dp[mini[v]][maxi[v]];
    }

    if(ans==0)
    {
        cout<<"Arpa"<<endl;
    }
    else
    {
        cout<<"Mojtaba"<<endl;
    }
}


/*
PROG: cf850c
LANG: C++
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
 */
#include <bits/stdc++.h>

using namespace std;

long long readi()
{
	long long input = 0;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	bool negative = false;
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
void prints(string output)
{
	for (int i = 0; i < output.length(); i++)
	{
		putchar(output[i]);
	}
	return;
}
long long getrand()
{
	long long rand1 = (rand() % 536870912);
	long long rand2 = (rand() % 536870912);
	return (rand1 * 536870912ll + rand2);
}

#define MP make_pair
#define PB push_back

#define SINF 10001
#define INF 1000000861
#define LLINF 1000000000000000861ll
#define MOD 1000000007
#define SQR 400
#define CO 1000861
#define EPS 0.000000000000001
#define PI 3.141592653589793
#define MAXN 1000010

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<ll> point;

int N;
ll arr[MAXN];
vector<ll> v[MAXN];
bool seen[MAXN];
ll grundy;
bool prime[MAXN];

ll vp(ll val, ll p)
{
	ll cnt = 0;
	while(val % p == 0)
	{
		val /= p;
		cnt++;
	}
	return cnt;
}
ll sg(ll a, ll b)
{
	if (a > b)
	{
		swap(a, b);
	}
	if (b >= 2 * a)
	{
		return a - 1;
	}
	return a;
}

int32_t main()
{
	srand(time(NULL));
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(10);
	ios_base::sync_with_stdio(false);
	if (fopen("cf850c.in", "r"))
	{
		freopen ("cf850c.in", "r", stdin);
		//freopen ("cf850c.out", "w", stdout);
	}
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> arr[i];
	}
	for (int i = 2; i < MAXN; i++)
	{
		prime[i] = true;
	}
	for (ll i = 2; i < MAXN; i++)
	{
		if (!prime[i])
		{
			continue;
		}
		for (ll j = i * i; j < MAXN; j += i)
		{
			prime[j] = false;
		}
	}
	for (ll i = 2; i < MAXN; i++)
	{
		if (!prime[i])
		{
			continue;
		}
		for (int j = 0; j < N; j++)
		{
			if (arr[j] % i)
			{
				continue;
			}
			v[i].PB(vp(arr[j], i));
		}
		if (v[i].empty())
		{
			continue;
		}
		v[i].erase(unique(v[i].begin(), v[i].end()), v[i].end());
		if (v[i].size() == 1)
		{
			grundy = grundy xor (v[i][0]);
			continue;
		}
		for (int j = 1; j < v[i].size(); j++)
		{
			grundy = grundy xor (sg(v[i][j], v[i][j - 1]));
		}
	}
	if (grundy)
	{
		cout << "Mojtaba\n";
	}
	else
	{
		cout << "Arpa\n";
	}
	return 0;
}


/*
PROG: cf850c
LANG: C++
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
 */
#include <bits/stdc++.h>

using namespace std;

long long readi()
{
	long long input = 0;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	bool negative = false;
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
void prints(string output)
{
	for (int i = 0; i < output.length(); i++)
	{
		putchar(output[i]);
	}
	return;
}
long long getrand()
{
	long long rand1 = (rand() % 536870912);
	long long rand2 = (rand() % 536870912);
	return (rand1 * 536870912ll + rand2);
}

#define MP make_pair
#define PB push_back

#define SINF 10001
#define INF 1000000861
#define LLINF 1000000000000000861ll
#define MOD 1000000007
#define SQR 400
#define CO 1000861
#define EPS 0.000000000000001
#define PI 3.141592653589793
#define MAXN 1000010

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<ll> point;

int N;
ll arr[MAXN];
ll grundy;
bool prime[MAXN];
ll val;
map<ll, int> mp;

ll vp(ll val, ll p)
{
	ll cnt = 0;
	while(val % p == 0)
	{
		val /= p;
		cnt++;
	}
	return cnt;
}
ll sg(ll mask)
{
	if (mask == 0)
	{
		return 0;
	}
	if (mp.find(mask) != mp.end())
	{
		return mp[mask];
	}
	set<int> s;
	for (int i = 1; (1ll << i) <= mask; i++)
	{
		ll val = 0;
		for (int j = 1; j < 40; j++)
		{
			if (!(mask & (1ll << j)))
			{
				continue;
			}
			if (j < i)
			{
				val = val bitor (1ll << j);
			}
			if (j > i)
			{
				val = val bitor (1ll << (j - i));
			}
		}
		s.insert(sg(val));
	}
	for (int i = 0; ; i++)
	{
		if (s.find(i) == s.end())
		{
			mp[mask] = i;
			return i;
		}
	}
}

int32_t main()
{
	srand(time(NULL));
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(10);
	ios_base::sync_with_stdio(false);
	if (fopen("cf850c.in", "r"))
	{
		freopen ("cf850c.in", "r", stdin);
		//freopen ("cf850c.out", "w", stdout);
	}
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> arr[i];
	}
	for (int i = 2; i < MAXN; i++)
	{
		prime[i] = true;
	}
	for (ll i = 2; i < MAXN; i++)
	{
		if (!prime[i])
		{
			continue;
		}
		for (ll j = i * i; j < MAXN; j += i)
		{
			prime[j] = false;
		}
	}
	for (ll i = 2; i < MAXN; i++)
	{
		if (!prime[i])
		{
			continue;
		}
		val = 0;
		for (int j = 0; j < N; j++)
		{
			if (arr[j] % i)
			{
				continue;
			}
			val = val bitor (1ll << (vp(arr[j], i)));
		}
		grundy = grundy xor sg(val);
	}
	if (grundy)
	{
		cout << "Mojtaba\n";
	}
	else
	{
		cout << "Arpa\n";
	}
	return 0;
}


/*
PROG: cf850c
LANG: C++
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
 */
#include <bits/stdc++.h>

using namespace std;

long long readi()
{
	long long input = 0;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	bool negative = false;
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
void prints(string output)
{
	for (int i = 0; i < output.length(); i++)
	{
		putchar(output[i]);
	}
	return;
}
long long getrand()
{
	long long rand1 = (rand() % 536870912);
	long long rand2 = (rand() % 536870912);
	return (rand1 * 536870912ll + rand2);
}

#define MP make_pair
#define PB push_back

#define SINF 10001
#define INF 1000000861
#define LLINF 1000000000000000861ll
#define MOD 1000000007
#define SQR 400
#define CO 1000861
#define EPS 0.000000000000001
#define PI 3.141592653589793
#define MAXN 1000010

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<ll> point;

int N;
ll arr[MAXN];
ll grundy;
bool prime[MAXN];
ll val;
map<ll, int> masks;
map<ll, int> mp;
map<ll, int> factors[MAXN];

void factorize(ll x)
{
	ll temp = x;
	for (ll i = 2; i * i <= x; i++)
	{
		ll cnt = 0;
		if (temp % i)
		{
			continue;
		}
		while (temp % i == 0)
		{
			cnt++;
			temp /= i;
		}
		masks[i] = masks[i] bitor (1ll << cnt);
	}
	if (temp != 1)
	{
		masks[temp] = masks[temp] bitor (2);
	}
}
ll sg(ll mask)
{
	if (mask == 0)
	{
		return 0;
	}
	if (mp.find(mask) != mp.end())
	{
		return mp[mask];
	}
	set<int> s;
	for (int i = 1; (1ll << i) <= mask; i++)
	{
		ll val = 0;
		for (int j = 1; j < 40; j++)
		{
			if (!(mask & (1ll << j)))
			{
				continue;
			}
			if (j < i)
			{
				val = val bitor (1ll << j);
			}
			if (j > i)
			{
				val = val bitor (1ll << (j - i));
			}
		}
		s.insert(sg(val));
	}
	for (int i = 0; ; i++)
	{
		if (s.find(i) == s.end())
		{
			mp[mask] = i;
			return i;
		}
	}
}

int32_t main()
{
	srand(time(NULL));
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(10);
	ios_base::sync_with_stdio(false);
	if (fopen("cf850c.in", "r"))
	{
		freopen ("cf850c.in", "r", stdin);
		//freopen ("cf850c.out", "w", stdout);
	}
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		ll x;
		cin >> x;
		factorize(x);
	}
	for (auto it = masks.begin(); it != masks.end(); it++)
	{
		grundy = grundy xor sg(it -> second);
	}
	if (grundy)
	{
		cout << "Mojtaba\n";
	}
	else
	{
		cout << "Arpa\n";
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int >
#define ull unsigned long long
#define pll pair < ll, ll >
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)
#define all(s) s.begin(), s.end()
#define sz(a) (int)a.size()

const int inf = (1ll << 30) - 1;
const int maxn = (int) 1e5 + 10;

using namespace std;
int n;
int a[111];
vector<int> p;

void go(int x){
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0){
			p.pb(i);
			while(x % i == 0) x/=i;
		}
	}
	if(x > 1) p.pb(x);
}

map<int, int> dp;

int get(int mask){
	if(mask == 0) return 0;
	if(dp.count(mask)) return dp[mask];

	int cnt = 0;
	set<int> S, u;
	for(int i = 0; i < 31; i++){
		int g = mask & ((1<<i) - 1);
		int d = mask >> (i + 1);
		if((d|g) != mask){
			//cout << (d|g) << endl;
			int cc = get(d|g);
			S.insert(cc);
		}
	}
	while(S.count(cnt)) cnt++;
	return dp[mask] = cnt;
}

int calc(int x){
	int mask = 0;
	for (int i = 0; i < n; ++i)
	{
		int cnt = 0;
		while(a[i] % x == 0){
			a[i] /= x;
			cnt++;
		}
		if(cnt){
			cnt--;
			mask |= (1<<cnt);
		}
	}
	return get(mask);
}

void solve(){
	//cout << get(3) << endl;
	//return;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++){
		go(a[i]);
	}
	for(int i = 0; i < 100; i++){
		//cout << i << " "<< get(i) << endl;
	}
	sort(all(p));
	int ans = 0;
	for(int i = 0; i < p.size(); i++){
		ans ^= calc(p[i]);
	}
	if(ans) printf("Mojtaba\n");
	else printf("Arpa\n");
}

int main () {
    //cout << "Hello world\n";
    int t=1;
    //scanf("%d", &t);
    for(int i=1; i <= t; i++){
      //printf("Case #%d\n", i);
      solve();
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int >
#define ull unsigned long long
#define pll pair < ll, ll >
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)
#define all(s) s.begin(), s.end()
#define sz(a) (int)a.size()

const int inf = (1ll << 30) - 1;
const int maxn = (int) 1e5 + 10;

using namespace std;
int n;
int a[111];
vector<int> p;

void go(int x){
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0){
			p.pb(x);
			while(x % i == 0) x/=i;
		}
	}
	if(x > 1) p.pb(x);
}

map<int, int> dp;

int get(int mask){
	if(mask == 0) return 0;
	if(dp.count(mask)) return dp[mask];

	int cnt = 0;
	set<int> S, u;
	for(int i = 0; i < 30; i++){
		int g = mask & ((1<<i) - 1);
		int d = mask >> (i + 1);
		if((d|g) != mask){
			int cc = get(d|g);
			S.insert(cc);
		}
	}
	while(S.count(cnt)) cnt++;
	return dp[mask] = cnt;
}

int calc(int x){
	int mask = 0;
	for (int i = 0; i < n; ++i)
	{
		int cnt = 0;
		while(a[i] % x == 0){
			a[i] /= x;
			cnt++;
		}
		if(cnt){
			mask |= (1<<(cnt-1));
		}
	}
	return get(mask);
}

void solve(){
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++){
		go(a[i]);
	}
	for(int i = 0; i < 100; i++){
		//cout << i << " "<< get(i) << endl;
	}
	sort(all(p));
	int ans = 0;
	for(int i = 0; i < p.size(); i++){
		ans ^= calc(p[i]);
	}
	if(ans) printf("Mojtaba\n");
	else printf("Arpa\n");
}

int main () {
    //cout << "Hello world\n";
    int t=1;
    //scanf("%d", &t);
    for(int i=1; i <= t; i++){
      //printf("Case #%d\n", i);
      solve();
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int >
#define ull unsigned long long
#define pll pair < ll, ll >
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)
#define all(s) s.begin(), s.end()
#define sz(a) (int)a.size()

const int inf = (1ll << 30) - 1;
const int maxn = (int) 1e5 + 10;

using namespace std;
int n;
int a[111];
vector<int> p;

void go(int x){
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0){
			p.pb(x);
			while(x % i == 0) x/=i;
		}
	}
	if(x > 1) p.pb(x);
}

map<int, int> dp;

int get(int mask){
	if(mask == 0) return 0;
	if(dp.count(mask)) return dp[mask];
	int cc = 0;
	while(mask >= (1<<cc)) cc++;

	int cnt = 1;
	set<int> S;
	for(int i = 0; i < 30; i++){
		int g = mask & ((1<<(i+1)) - 1);
		int d = mask >> (i + 1);
		if((d|g) != mask) cnt ^= get(d|g);
	}
	return dp[mask] = cnt;
}

int calc(int x){
	int mask = 0;
	for (int i = 0; i < n; ++i)
	{
		int cnt = 0;
		while(a[i] % x == 0){
			a[i] /= x;
			cnt++;
		}
		if(cnt){
			mask |= (1<<(cnt-1));
		}
	}
	return get(mask);
}

void solve(){
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++){
		go(a[i]);
	}
	for(int i = 0; i < 100; i++){
		//cout << i << " "<< get(i) << endl;
	}
	sort(all(p));
	int ans = 0;
	for(int i = 0; i < p.size(); i++){
		ans ^= calc(p[i]);
	}
	if(ans) printf("Mojtaba\n");
	else printf("Arpa\n");
}

int main () {
    //cout << "Hello world\n";
    int t=1;
    //scanf("%d", &t);
    for(int i=1; i <= t; i++){
      //printf("Case #%d\n", i);
      solve();
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#define pb push_back
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pii pair < int, int >
#define ull unsigned long long
#define pll pair < ll, ll >
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)
#define all(s) s.begin(), s.end()
#define sz(a) (int)a.size()

const int inf = (1ll << 30) - 1;
const int maxn = (int) 1e5 + 10;

using namespace std;
int n;
int a[111];
vector<int> p;

void go(int x){
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0){
			p.pb(x);
			while(x % i == 0) x/=i;
		}
	}
	if(x > 1) p.pb(x);
}

map<int, int> dp;

int get(int mask){
	if(mask == 0) return 0;
	if(dp.count(mask)) return dp[mask];

	int cnt = 0;
	set<int> S, u;
	for(int i = 0; i < 31; i++){
		int g = mask & ((1<<i) - 1);
		int d = mask >> (i + 1);
		if((d|g) != mask){
			int cc = get(d|g);
			S.insert(cc);
		}
	}
	while(S.count(cnt)) cnt++;
	return dp[mask] = cnt;
}

int calc(int x){
	int mask = 0;
	for (int i = 0; i < n; ++i)
	{
		int cnt = 0;
		while(a[i] % x == 0){
			a[i] /= x;
			cnt++;
		}
		if(cnt){
			cnt--;
			mask |= (1<<cnt);
		}
	}
	return get(mask);
}

void solve(){
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++){
		go(a[i]);
	}
	for(int i = 0; i < 100; i++){
		//cout << i << " "<< get(i) << endl;
	}
	sort(all(p));
	int ans = 0;
	for(int i = 0; i < p.size(); i++){
		ans ^= calc(p[i]);
	}
	if(ans) printf("Mojtaba\n");
	else printf("Arpa\n");
}

int main () {
    //cout << "Hello world\n";
    int t=1;
    //scanf("%d", &t);
    for(int i=1; i <= t; i++){
      //printf("Case #%d\n", i);
      solve();
    }

    return 0;
}