#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define f first
#define s second
#define ll long long

using namespace std;

const int MAX = 4e5 + 5;

int n;
int v[MAX];
int partial_sums[MAX];
int poz[MAX];

int main() {
	cin.sync_with_stdio(false);
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> v[i];
		partial_sums[i] = (partial_sums[i - 1] + v[i] % n) % n;
	}

	for (int i = 1; i <= n; i++) {
		if (!partial_sums[i]) {
			cout << 1 << ' ' << i;
			return 0;
		}
	}

	for (int i = 1; i <= n; i++) {
		if (poz[partial_sums[i]]) {
			cout << poz[partial_sums[i]] + 1 << ' ' << i;
			return 0;
		}
		poz[partial_sums[i]] = i;
	}

	return 0;
}