You are given a string s of length n consisting only of lowercase Latin letters.

A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.

Your task is to calculate the number of ways to remove exactly one substring from this string in such a way that all remaining characters are equal (the number of distinct characters either zero or one).

It is guaranteed that there is at least two different characters in s.

Note that you can remove the whole string and it is correct. Also note that you should remove at least one character.

Since the answer can be rather large (not very large though) print it modulo 998244353.

If you are Python programmer, consider using PyPy instead of Python when you submit your code.

Input

The first line of the input contains one integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the length of the string s.

The second line of the input contains the string s of length n consisting only of lowercase Latin letters.

It is guaranteed that there is at least two different characters in s.

Output

Print one integer — the number of ways modulo 998244353 to remove exactly one substring from s in such way that all remaining characters are equal.

Examples

Input


4
abaa


Output


6


Input


7
aacdeee


Output


6

Input


2
az


Output


3

Note

Let s[l; r] be the substring of s from the position l to the position r inclusive.

Then in the first example you can remove the following substrings: 

  * s[1; 2]; 
  * s[1; 3]; 
  * s[1; 4]; 
  * s[2; 2]; 
  * s[2; 3]; 
  * s[2; 4]. 



In the second example you can remove the following substrings: 

  * s[1; 4]; 
  * s[1; 5]; 
  * s[1; 6]; 
  * s[1; 7]; 
  * s[2; 7]; 
  * s[3; 7]. 



In the third example you can remove the following substrings: 

  * s[1; 1]; 
  * s[1; 2]; 
  * s[2; 2]. 


import java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
import java.util.HashMap;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.io.DataInputStream; 
import java.io.FileInputStream; 
public class Prac {
    public static int min(int a,int b,int c){
        if(a<b){
            if(a<c)
                return a;
            
            else
                return c;
        }
        else{
            if(b<c)
                return b;
            else
                return c;
        }   
}
    public static int max(int a,int b,int c){
        if(a<b){
            if(b<c)
                return c;
            
            else
                return b;
        }
        else{
            if(a<c)
                return c;
            else
                return a;
        }   
}
    static class InputReader {
 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
 
		public InputReader(InputStream st) {
			this.stream = st;
		}
 
		public int read() {
			if (snumChars == -1)
	 			throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}
 
		public String rs() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
	}
    static abstract class MultiSetImpl<ValueType, MapType extends Map<ValueType, Integer>> implements MultiSet<ValueType> {
        protected final MapType map;
        protected int size;
        protected int distinctCount;

        protected MultiSetImpl(MapType map) {
            this.map = map;
            this.size = 0;
        }

        public void add(ValueType value) {
            int count = getCount(value);
            if (count == 0) ++distinctCount;
            map.put(value, count + 1);
            ++size;
        }

        public boolean remove(ValueType value) {
            int count = getCount(value);
            if (count == 0) return false;

            if (count == 1) map.remove(value);
            else map.put(value, count - 1);
            if (count == 1) --distinctCount;
            --size;
            return true;
        }

        public int getCount(ValueType value) {
            Integer count = map.get(value);
            return (count == null ? 0 : count);
        }

        @Override
        public String toString() {
            StringBuilder stringBuilder = new StringBuilder();
            for (ValueType key : map.keySet()) {
                stringBuilder.append("[" + key.toString() + " " + map.get(key).toString() + "] ");
            }
            return stringBuilder.toString();
        }

    }

    static interface MultiSet<ValueType> {
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

    static class HashMultiSet<ValueType> extends MultiSetImpl<ValueType, Map<ValueType, Integer>> {
        public HashMultiSet(Map<ValueType, Integer> map) {
            super(map);
        }

    }

    
    
    static PrintWriter w = new PrintWriter(System.out);
    
    public static void main(String[] args) throws IOException {
        InputReader sc=new InputReader(System.in);
        //Scanner sc=new Scanner(System.in);
        HashMultiSet<Integer> multiSet = new HashMultiSet<>(new HashMap<>());
       
        StringBuilder stringBuilder = new StringBuilder();
        int mod=998244353,i=0;
        int k=sc.ni();
       String s=sc.nextLine();
       int n=s.length();
        long left=0,right=0;
        boolean leftfound=false,rightfound=false;
        for(i=0;i<n;i++){
            if(s.charAt(i)==s.charAt(0)&&!leftfound){
                left++;  
            }
            else
                leftfound=true;
            if(s.charAt(n-1-i)==s.charAt(n-1)&&!rightfound)
                right++;
            else
                rightfound=true;
        }
        long ans=0;
        ans=(left+right+1)%mod;
        if(s.charAt(0)==s.charAt(n-1)){
            ans=((left+1)*(right+1))%mod;
        }
        w.println(ans);
       w.close();
    }  
}