#include <bits/stdc++.h>
using namespace std;
int oceanview(vector<int> H) {
  int count = 1;
  int i, j;
  for (i = 1; i < sizeof(H[i]) + 1; i++) {
    for (j = i; j > -1; j--) {
      if (H[i] >= H[j]) {
        continue;
      } else
        break;
    }
    if (j == -1) count++;
    cout << i << " " << H[i] << endl;
  }
  return count;
}
int main() {
  int N;
  cin >> N;
  vector<int> H(N, 0);
  for (int i = 0; i < N; i++) cin >> H[i];
  cout << oceanview(H) << endl;
  return 0;
}
