Problem: Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left untouched for centuries, from watching icebergs in freezing weather to scuba-diving in oceans and admiring the sea life, residing unseen. These experiences were enhanced with breathtaking views built by mountains over time and left there for visitors to see for years on end. Over time, all these expeditions took a toll on Sarah and culminated in her decision to settle down in the suburbs and live a quiet life. 

However, as Sarah's love for nature never faded, she started growing flowers in her garden in an attempt to stay connected with nature. At the beginning she planted only blue orchids, but over time she started using different flower types to add variety to her collection of flowers. This collection of flowers can be represented as an array of N flowers and the i-th of them has a type associated with it, denoted as A_i. Each resident, passing by her collection and limited by the width of his view, can only see K contiguous flowers at each moment in time. To see the whole collection, the resident will look at the first K contiguous flowers A_1, A_2, ..., A_K, then shift his view by one flower and look at the next section of K contiguous flowers A_2, A_3, ..., A_{K+1} and so on until they scan the whole collection, ending with section A_{N-K+1}, ..., A_{N-1}, A_N.

Each resident determines the beautiness of a section of K flowers as the number of distinct flower types in that section. Furthermore, the beautiness of the whole collection is calculated by summing the beautiness values of each contiguous section. Formally, beautiness B_i of a section starting at the i-th position is calculated as B_i = distinct(A_i, A_{i+1}, ..., A_{i+K-1}), and beautiness of the collection B is calculated as B=B_1 + B_2 + ... + B_{N-K+1}.

In addition, as Sarah wants to keep her collection of flowers have a fresh feel, she can also pick two points L and R, dispose flowers between those two points and plant new flowers, all of them being the same type.

You will be given Q queries and each of those queries will be of the following two types: 

  1. You will be given three integers L, R, X describing that Sarah has planted flowers of type X between positions L and R inclusive. Formally collection is changed such that A[i]=X for all i in range [L.. R]. 
  2. You will be given integer K, width of the resident's view and you have to determine the beautiness value B resident has associated with the collection 



For each query of second type print the result – beautiness B of the collection.

Input

First line contains two integers N and Q \;(1 ≤ N, Q ≤ 10^5)  — number of flowers and the number of queries, respectively.

The second line contains N integers A_1, A_2, ..., A_N\;(1 ≤ A_i ≤ 10^9)  — where A_i represents type of the i-th flower.

Each of the next Q lines describe queries and start with integer T∈\{1, 2\}. 

  * If T = 1, there will be three more integers in the line L, R, X\;(1 ≤ L, R ≤ N;\; 1 ≤ X ≤ 10^9)  — L and R describing boundaries and X describing the flower type 
  * If T = 2, there will be one more integer in the line K\;(1 ≤ K ≤ N)  — resident's width of view 

Output

For each query of the second type print the beautiness B of the collection.

Example

Input


5 5
1 2 3 4 5
2 3
1 1 2 5
2 4
1 2 4 5
2 2


Output


9
6
4

Note

Let's look at the example.

Initially the collection is [1, 2, 3, 4, 5]. In the first query K = 3, we consider sections of three flowers with the first being [1, 2, 3]. Since beautiness of the section is the number of distinct flower types in that section, B_1 = 3. Second section is [2, 3, 4] and B_2 = 3. Third section is [3, 4, 5] and B_3 = 3, since the flower types are all distinct. The beautiness value resident has associated with the collection is B = B_1 + B_2 + B_3 = 3 + 3 + 3 = 9.

After the second query, the collection becomes [5, 5, 3, 4, 5]. 

For the third query K = 4, so we consider sections of four flowers with the first being [5, 5, 3, 4]. There are three distinct flower types [5, 3, 4] in this section, so B_1 = 3. Second section [5, 3, 4, 5] also has 3 distinct flower types, so B_2 = 3. The beautiness value resident has associated with the collection is B = B_1 + B_2 = 3 + 3 = 6

After the fourth query, the collection becomes [5, 5, 5, 5, 5].

For the fifth query K = 2 and in this case all the four sections are same with each of them being [5, 5]. Beautiness of [5, 5] is 1 since there is only one distinct element in this section [5]. Beautiness of the whole collection is B = B_1 + B_2 + B_3 + B_4 = 1 + 1 + 1 + 1 = 4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = 1e3 + 5;
const long long INF = 1e18 + 5;
inline long long read() {
  long long sum = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * fh;
}
inline int read2() {
  char c = getchar();
  while (c != 'a' && c != 'b' && c != 'c' && c != '?') c = getchar();
  return c == '?' ? 0 : c - 'a' + 1;
}
inline int read3() {
  char c = getchar();
  while (c < 'a' || c > 'z') {
    c = getchar();
  }
  return c - 'a';
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
inline long long ab(long long x) { return x < 0 ? -x : x; }
inline long long fpow(long long qwe, long long asd, long long zxc) {
  if (asd < 0) return 0;
  long long a = qwe, b = 1, c = asd;
  while (c) {
    if (c & 1) b = b * a % zxc;
    a = a * a % zxc;
    c >>= 1;
  }
  return b;
}
struct miaow {
  int l, r;
  long long sz, sum;
} t[N * 4 + 5];
inline void csh(int l, int r, int o) {
  t[o].l = l, t[o].r = r;
  t[o].sz = t[o].sum = 0;
  if (l == r) {
    return;
  }
  int mid = (l + r) >> 1;
  csh(l, mid, (o * 2)), csh(mid + 1, r, (o * 2 + 1));
}
inline void xg(int k, int o, int x) {
  if (t[o].l == t[o].r) {
    t[o].sz += x;
    t[o].sum = t[o].l * t[o].sz;
    return;
  }
  int mid = (t[o].l + t[o].r) >> 1;
  if (k <= mid)
    xg(k, (o * 2), x);
  else
    xg(k, (o * 2 + 1), x);
  t[o].sz = t[(o * 2)].sz + t[(o * 2 + 1)].sz;
  t[o].sum = t[(o * 2)].sum + t[(o * 2 + 1)].sum;
}
inline pair<long long, long long> cx(int l, int r, int o) {
  if (l <= t[o].l && r >= t[o].r)
    return pair<long long, long long>(t[o].sz, t[o].sum);
  pair<long long, long long> qwe(0, 0), asd(0, 0);
  int mid = (t[o].l + t[o].r) >> 1;
  if (l <= mid) qwe = cx(l, min(mid, r), (o * 2));
  if (r > mid) asd = cx(max(mid + 1, l), r, (o * 2 + 1));
  return pair<long long, long long>(qwe.first + asd.first,
                                    qwe.second + asd.second);
}
struct meow {
  int l, r;
  int sz;
  meow(int l1 = 0, int r1 = 0, int sz1 = 0) { l = l1, r = r1, sz = sz1; }
  inline bool operator<(const meow& qwe) const { return l < qwe.l; }
};
set<meow> wz[N], odt;
inline void del(int l, int r, int x) {
  set<meow>::iterator qwe, asd, zxc;
  qwe = asd = zxc = wz[x].lower_bound(meow(l, r, x));
  --qwe, ++zxc;
  int l1 = qwe->l, r1 = qwe->r, l2 = asd->l, r2 = asd->r, l3 = zxc->l,
      r3 = zxc->r;
  xg(l2 - r1, 1, -1), xg(l3 - r2, 1, -1);
  xg(l3 - r1, 1, 1);
  wz[x].erase(asd);
}
inline void ins(int l, int r, int x) {
  set<meow>::iterator qwe, asd, zxc;
  qwe = asd = zxc = wz[x].insert(meow(l, r, x)).first;
  --qwe, ++zxc;
  int r1 = qwe->r, l3 = zxc->l;
  xg(l3 - r1, 1, -1);
  xg(l - r1, 1, 1), xg(l3 - r, 1, 1);
}
inline void cr(int l, int r, int x) {
  set<meow>::iterator qwe = odt.upper_bound(meow(l)),
                      asd = odt.upper_bound(meow(r));
  --qwe, --asd;
  if (qwe == asd) {
    int l1 = qwe->l, r1 = qwe->r, sz1 = qwe->sz;
    del(l1, r1, sz1);
    odt.erase(qwe);
    if (l1 == l) {
      if (r1 == r) {
        odt.insert(meow(l, r, x));
        ins(l, r, x);
      } else {
        odt.insert(meow(l, r, x));
        ins(l, r, x);
        odt.insert(meow(r + 1, r1, sz1));
        ins(r + 1, r1, sz1);
      }
    } else {
      if (r1 == r) {
        odt.insert(meow(l, r, x));
        ins(l, r, x);
        odt.insert(meow(l1, l - 1, sz1));
        ins(l1, l - 1, sz1);
      } else {
        odt.insert(meow(l, r, x));
        ins(l, r, x);
        odt.insert(meow(l1, l - 1, sz1));
        ins(l1, l - 1, sz1);
        odt.insert(meow(r + 1, r1, sz1));
        ins(r + 1, r1, sz1);
      }
    }
  } else {
    int l1 = qwe->l, r1 = qwe->r, sz1 = qwe->sz, l2 = asd->l, r2 = asd->r,
        sz2 = asd->sz;
    del(l1, r1, sz1), del(l2, r2, sz2);
    set<meow>::iterator i = qwe;
    ++i;
    for (; i != asd; ++i) {
      int l3 = i->l, r3 = i->r, sz3 = i->sz;
      del(l3, r3, sz3);
    }
    ++asd;
    odt.erase(qwe, asd);
    odt.insert(meow(l, r, x));
    ins(l, r, x);
    if (l1 != l) {
      odt.insert(meow(l1, l - 1, sz1));
      ins(l1, l - 1, sz1);
    }
    if (r2 != r) {
      odt.insert(meow(r + 1, r2, sz2));
      ins(r + 1, r2, sz2);
    }
  }
}
map<int, int> ls;
struct nya {
  int o, l, r, x;
  nya(int o1 = 0, int l1 = 0, int r1 = 0, int x1 = 0) {
    o = o1, l = l1, r = r1, x = x1;
  }
} q[N];
int lxsz[N], lxcou = 0, lxjs = 0;
int a[N], n, m;
inline void lxh() {
  sort(lxsz + 1, lxsz + lxcou + 1);
  int sz = 0;
  for (int i = 1; i <= lxcou; ++i) {
    if (lxsz[i] != sz) {
      sz = lxsz[i];
      ++lxjs;
      ls[sz] = lxjs;
    }
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) {
    a[i] = read();
    lxsz[++lxcou] = a[i];
  }
  for (int i = 1; i <= m; ++i) {
    int o = read(), l, r, x;
    if (o == 1) {
      l = read(), r = read(), x = read();
      lxsz[++lxcou] = x;
      q[i] = nya(o, l, r, x);
    } else {
      x = read();
      q[i] = nya(o, 0, 0, x);
    }
  }
  lxh();
  csh(1, n + 1, 1);
  for (int i = 1; i <= lxjs; ++i) {
    wz[i].insert(meow(0, 0, i));
    wz[i].insert(meow(n + 1, n + 1, i));
    xg(n + 1, 1, 1);
  }
  for (int i = 1; i <= n; ++i) {
    a[i] = ls[a[i]];
    odt.insert(meow(i, i, a[i]));
    ins(i, i, a[i]);
  }
  for (int i = 1; i <= m; ++i) {
    int o = q[i].o, l = q[i].l, r = q[i].r;
    long long x = q[i].x;
    if (o == 1) {
      x = ls[x];
      cr(l, r, x);
    } else {
      long long ans = 1ll * lxjs * (n - x + 1);
      pair<long long, long long> qwe = cx(x, n + 1, 1);
      ans -= qwe.second - qwe.first * x;
      write(ans), putchar('\n');
    }
  }
}