#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline string tostr(const T& x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
const double EPS = 1e-6;
const int INF = 1000 * 1000 * 1000;
const char CINF = 102;
const long long LINF = INF * 1ll * INF;
const long double PI = 3.1415926535897932384626433832795;
long long xs[210000];
int haspt[210000];
struct val {
  long long res;
  long long sum;
  long long cnt;
  long long l, r;
  val() {}
  val(long long l, long long r, long long cnt)
      : res(0), sum(cnt * l), cnt(cnt), l(l), r(r) {}
  val(val a, val b) {
    l = a.l;
    r = b.r;
    cnt = a.cnt + b.cnt;
    sum = a.sum + b.sum;
    res = a.res + b.res + (a.r * a.cnt - a.sum) * b.cnt +
          (b.sum - b.l * b.cnt) * a.cnt;
  }
};
val tree[1100000];
void init(int a, int b, int k) {
  if (b == a + 1) {
    tree[k] = val(xs[a], xs[b], haspt[a]);
    return;
  }
  int c = (a + b) / 2;
  init(a, c, k * 2 + 1);
  init(c, b, k * 2 + 2);
  tree[k] = val(tree[k * 2 + 1], tree[k * 2 + 2]);
}
void updpt(int p, int v, int a, int b, int k) {
  if (b == a + 1) {
    tree[k] = val(xs[a], xs[b], v);
    return;
  }
  int c = (a + b) / 2;
  if (p < c)
    updpt(p, v, a, c, k * 2 + 1);
  else
    updpt(p, v, c, b, k * 2 + 2);
  tree[k] = val(tree[k * 2 + 1], tree[k * 2 + 2]);
}
val getseg(int l, int r, int a, int b, int k) {
  if (l == a && r == b) return tree[k];
  int c = (a + b) / 2;
  if (r <= c) return getseg(l, r, a, c, k * 2 + 1);
  if (l >= c) return getseg(l, r, c, b, k * 2 + 2);
  return val(getseg(l, c, a, c, k * 2 + 1), getseg(c, r, c, b, k * 2 + 2));
}
long long pts[110000];
long long pts1[110000];
int qtype[110000];
int qa[110000];
int qb[110000];
int main() {
  ios_base::sync_with_stdio(false);
  int n0;
  cin >> n0;
  int n = 0;
  for (int i = 0; i < (n0); ++i) {
    cin >> pts[i];
    pts1[i] = pts[i];
    xs[n++] = pts1[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < (m); ++i) {
    cin >> qtype[i] >> qa[i] >> qb[i];
    if (qtype[i] == 1) {
      --qa[i];
      pts1[qa[i]] += qb[i];
      xs[n++] = pts1[qa[i]];
    }
  }
  sort(xs, xs + n);
  n = unique(xs, xs + n) - xs;
  xs[n] = INF * 2;
  for (int i = 0; i < (n0); ++i) {
    int p = lower_bound(xs, xs + n, pts[i]) - xs;
    if (xs[p] != pts[i]) exit(66);
    haspt[p] = 1;
  }
  init(0, n, 0);
  for (int i = 0; i < (m); ++i) {
    if (qtype[i] == 1) {
      int p = lower_bound(xs, xs + n, pts[qa[i]]) - xs;
      updpt(p, 0, 0, n, 0);
      pts[qa[i]] += qb[i];
      p = lower_bound(xs, xs + n, pts[qa[i]]) - xs;
      if (xs[p] != pts[qa[i]]) exit(123);
      updpt(p, 1, 0, n, 0);
    } else {
      int a = lower_bound(xs, xs + n, qa[i]) - xs;
      int b = upper_bound(xs, xs + n, qb[i]) - xs;
      long long r;
      if (b == a)
        r = 0;
      else
        r = getseg(a, b, 0, n, 0).res;
      cout << r << '\n';
    }
  }
  return 0;
}
