Game field is represented by a line of n square cells. In some cells there are packmen, in some cells there are asterisks and the rest of the cells are empty. Packmen eat asterisks.

Before the game starts you can choose a movement direction, left or right, for each packman. Once the game begins all the packmen simultaneously start moving according their directions. A packman can't change the given direction.

Once a packman enters a cell containing an asterisk, packman immediately eats the asterisk. Once the packman leaves the cell it becomes empty. Each packman moves at speed 1 cell per second. If a packman enters a border cell, the packman stops. Packmen do not interfere with the movement of other packmen; in one cell there can be any number of packmen moving in any directions.

Your task is to assign a direction to each packman so that they eat the maximal number of asterisks. If there are multiple ways to assign directions to eat the maximal number of asterisks, you should choose the way which minimizes the time to do that.

Input

The first line contains integer number n (2 ≤ n ≤ 1 000 000) — the number of cells in the game field.

The second line contains n characters. If the i-th character is '.', the i-th cell is empty. If the i-th character is '*', the i-th cell contains an asterisk. If the i-th character is 'P', the i-th cell contains a packman.

The field contains at least one asterisk and at least one packman.

Output

Print two integer numbers — the maximal number of asterisks packmen can eat and the minimal time to do it.

Examples

Input

6
*.P*P*


Output

3 4


Input

8
*...P..*


Output

1 3

Note

In the first example the leftmost packman should move to the right, the rightmost packman should move to the left. All the asterisks will be eaten, the last asterisk will be eaten after 4 seconds.
#include <bits/stdc++.h>
using namespace std;
char string_in_buffer[(int)2e6];
void fast_scan(int &first) { scanf("%d", &first); }
void fast_scan(long long &first) { scanf("%lld", &first); }
void fast_scan(unsigned long long &first) { scanf("%llu", &first); }
void fast_scan(double &first) { scanf("%lf", &first); }
void fast_scan(long double &first) { scanf("%Lf", &first); }
void fast_scan(char &first) {
  scanf("%c", &first);
  if (first == '\n') {
    fast_scan(first);
  }
}
void fast_scan(string &first) {
  scanf("%s", string_in_buffer);
  first = string(string_in_buffer);
}
template <class TFirst, class TSecond>
void fast_scan(pair<TFirst, TSecond> &p) {
  fast_scan(p.first);
  fast_scan(p.second);
}
template <class T>
void fast_scan(vector<T> &v) {
  for (auto &first : v) fast_scan(first);
}
void fast_print(const int &first) { printf("%d", first); }
void fast_print(const long long &first) { printf("%lld", first); }
void fast_print(const unsigned long long &first) { printf("%llu", first); }
void fast_print(const double &first) { printf("%.15lf", first); }
void fast_print(const long double &first) { printf("%.15Lf", first); }
void fast_print(const char &first) { printf("%c", first); };
void fast_print(const string &first) { printf("%s", first.c_str()); }
template <class TFirst, class TSecond>
void fast_print(const pair<TFirst, TSecond> &p) {
  fast_print(p.first);
  fast_print(' ');
  fast_print(p.second);
}
template <class T>
void fast_print(const vector<T> &v) {
  if (v.empty()) return;
  fast_print(v[0]);
  for (int i = 1; i < v.size(); i++) {
    fast_print(" ");
    fast_print(v[i]);
  }
}
template <class T>
void fast_print(const vector<vector<T>> &v) {
  if (v.empty()) return;
  fast_print(v[0]);
  for (int i = 1; i < v.size(); i++) {
    fast_print("\n");
    fast_print(v[i]);
  }
}
using namespace std;
namespace smart_io {
string print_start = "";
string sep = " ";
bool first_print = false;
void precall_print() {
  fast_print(print_start);
  print_start = "\n";
  first_print = true;
}
}  // namespace smart_io
template <class T>
ostream &operator,(ostream &os, const T &object) {
  if (!smart_io::first_print) {
    fast_print(smart_io::sep);
  } else {
    smart_io::first_print = false;
  }
  fast_print(object);
  return os;
}
template <class T>
istream &operator,(istream &is, T &object) {
  fast_scan(object);
  return is;
}
namespace typedefs {}
namespace numbers_operation {
template <class T>
T floor_mod(T a, T b) {
  if (a % b == 0) return 0;
  if (a >= 0 && b >= 0) return a % b;
  if (a <= 0 && b <= 0) return a % b;
  return abs(b) - (abs(a) % abs(b));
}
}  // namespace numbers_operation
using namespace numbers_operation;
using namespace typedefs;
signed main(signed argc, char *argv[]) {
  int n;
  cin, n;
  string s;
  cin, s;
  vector<int> stars;
  for (int i = 0; i < ((int)s.size()); i++) {
    if (s[i] == '*') {
      stars.push_back(i);
    }
  }
  int pacs = 0;
  for (char c : s) {
    pacs += (c == 'P');
  }
  if (pacs == 1) {
    int pac_pos = -1;
    for (int i = 0; i < n; i++) {
      if (s[i] == 'P') {
        pac_pos = i;
        break;
      }
    }
    int r = 0;
    int l = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == 'P') break;
      l += (s[i] == '*');
    }
    for (int i = n - 1; i > -1; i--) {
      if (s[i] == 'P') break;
      r += (s[i] == '*');
    }
    if (make_pair(l, stars[0] - pac_pos) >
        make_pair(r, pac_pos - stars.back())) {
      smart_io::precall_print();
      cout, l, pac_pos - stars[0];
    } else {
      smart_io::precall_print();
      cout, r, stars.back() - pac_pos;
    }
    return 0;
  }
  vector<int> left_pac(n, -1);
  for (int i = 0; i < n; i++) {
    if (s[i] == 'P') {
      left_pac[i] = i;
    } else {
      if (i > 0) {
        left_pac[i] = left_pac[i - 1];
      }
    }
  }
  int left = 0;
  int right = n + 2;
  while (right - left > 1) {
    int mid = (left + right) / 2;
    bool can = true;
    int it = ((int)stars.size());
    vector<int> dp(n, -1);
    auto get = [&dp](int i) {
      if (i < 0) return (int)1e9;
      return dp[i];
    };
    for (int i = 0; i < n; i++) {
      int pref = get(i - 1);
      dp[i] = -1;
      auto update = [&dp, i](int value) {
        if (dp[i] == -1) {
          dp[i] = value;
        } else {
          dp[i] = min(dp[i], value);
        }
      };
      {
        if (pref != -1) {
          if (s[i] == 'P') {
            update(0);
          } else if (s[i] == '*') {
            if (pref + 1 <= mid) {
              update(pref + 1);
            }
          } else {
            update(pref + 1);
          }
        }
      }
      {
        if (s[i] == 'P') {
          int j = i - mid - 1;
          int last = (i == 0) ? -1 : left_pac[i - 1];
          if (last == -1) {
            if (get(j) != -1) {
              update(1e9);
            }
          } else {
            {
              int pos = max(last, j);
              int pref = get(pos);
              if (pref != -1) {
                update(i - pos + pref);
              }
            }
            if (last > j) {
              int pppac = (last <= 0) ? -1 : left_pac[last - 1];
              int pos = min(last - 1, max(pppac, j));
              int pref = get(pos);
              if (pref != -1) {
                update(i - last);
              }
            }
          }
        }
      }
    }
    can = (dp[n - 1] != -1);
    if (can) {
      right = mid;
    } else {
      left = mid;
    }
  }
  smart_io::precall_print();
  cout, ((int)stars.size()), right;
}
