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 javafx.scene.layout.Priority;

import java.io.*;
import java.lang.reflect.Array;
import java.net.Inet4Address;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class templ implements Runnable {
    public class triplet implements Comparable
    {
        int f,s;
        long t;
        triplet(int f,int s,long t)
        {
            this.f=f;
            this.s=s;
            this.t=t;
        }
        public boolean equals(Object o)
        {
            triplet ob=(triplet)o;
            int ff,ss;
            long tt;
            if(o!=null)
            {
                ff=ob.f;
                ss=ob.s;
                tt=ob.t;
                if((ff==this.f)&&(ss==this.s)&&(tt==this.t))
                    return true;
            }
            return false;
        }
        public int hashCode()
        {
            return (this.f+" "+this.s+" "+this.t).hashCode();
        }
        public int compareTo(Object o)
        {
            triplet tr=(triplet)o;
            if(t>tr.t)
                return 1;
            else
                return -1;
        }
    }
    public class pair implements Comparable
    {
        int f;
        int s;
        pair(int f,int s)
        {
            this.f=f;
            this.s=s;
        }
        public boolean equals(Object o)
        {
            pair ob=(pair)o;
            int ff;
            int ss;
            if(o!=null)
            {
                ff=ob.f;
                ss=ob.s;
                if((ff==this.f)&&(ss==this.s))
                    return true;
            }
            return false;
        }
        public int hashCode()
        {
            return (this.f+" "+this.s).hashCode();
        }
        public int compareTo(Object o)
        {
            pair pr=(pair)o;
            if(s>pr.s)
                return 1;
            else if(s==pr.s)
            {
                if(f<pr.f)
                    return -1;
                else
                    return 1;
            }
            else
                return -1;
        }
    }
    int lazy[],d[];
    long tree[];
    void update(int node,int start,int end,int l,int r)
    {
        if(lazy[node]!=0)
        {
            if(start==end)
            {
                tree[node]=tree[node]+(long)d[start]*lazy[node];
            }
            if(start!=end)
            {
                tree[node]+=lazy[node];
                lazy[2*node]+=lazy[node];
                lazy[2*node+1]+=lazy[node];
            }
            lazy[node]=0;
        }
        if(start>r||l>end)
            return;
        if(start>=l&&end<=r)
        {
            if(start==end)
            {
                tree[node]+=d[start];
            }
            if(start!=end)
            {
                tree[node]+=1;
                lazy[2*node]+=1;
                lazy[2*node+1]+=1;
            }
            return;
        }
        int mid=(start+end)/2;
        update(2*node,start,mid,l,r);
        update(2*node+1,mid+1,end,l,r);
        tree[node]=Math.min(tree[2*node],tree[2*node+1]);
    }
    void update1(int node,int start,int end,int idx,int val)
    {
        if(lazy[node]!=0)
        {
            if(start==end)
            {
                tree[node]=tree[node]+(long)d[start]*lazy[node];
            }
            if(start!=end)
            {
                tree[node]+=lazy[node];
                lazy[2*node]+=lazy[node];
                lazy[2*node+1]+=lazy[node];
            }
            lazy[node]=0;
        }
        if(idx<start||idx>end)
            return;
        if(start==end)
        {
            tree[node]+=val;
            return;
        }
        int mid=(start+end)/2;
        update1(2*node,start,mid,idx,val);
        update1(2*node+1,mid+1,end,idx,val);
        tree[node]=Math.min(tree[2*node],tree[2*node+1]);
    }
    long query(int node,int start,int end,int idx)
    {
        if(lazy[node]!=0)
        {
            if(start==end)
            {
                tree[node]=tree[node]+(long)d[start]*lazy[node];
            }
            if(start!=end)
            {
                tree[node]+=lazy[node];
                lazy[2*node]+=lazy[node];
                lazy[2*node+1]+=lazy[node];
            }
            lazy[node]=0;
        }
        if(idx<start||idx>end)
            return Long.MAX_VALUE/10;
        if(start==end)
            return tree[node];
        int mid=(start+end)/2;
        long x=query(2*node,start,mid,idx);
        long y=query(2*node+1,mid+1,end,idx);
        return Math.min(x,y);
    }
    public int justsmall(long a[],int l,int r,long x,long val)
    {
        int p=-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if((a[mid]-val)<=x)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return p;
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new templ(),"templ",1<<27).start();
    }
    public void run()
    {
        try
        {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            int l=in.ni();
            String s=in.nextLine();
            long count1=1,count2=1;
            for(int i=1;i<l;i++)
            {
                char c=s.charAt(i);
                char c1=s.charAt(i-1);
                if(c!=c1)
                    break;
                count1++;
            }
            for(int i=l-2;i>=0;i--)
            {
                char c=s.charAt(i);
                char c1=s.charAt(i+1);
                if(c!=c1)
                    break;
                count2++;
            }
            count1++;
            count2++;
            long M=998244353;
            if(s.charAt(0)==s.charAt(l-1))
                out.println((count1%M*count2%M)%M);
            else
                out.println(count1+count2-1);
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

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

        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[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            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;
        }

    }
}