import java.io.*;
import java.lang.String;
import java.util.Arrays;
import java.util.StringTokenizer;

public class atoms_nb_java {
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException {
        int n = in.nextInt();

        Value[] arr = new Value[n];

        int prev = in.nextInt();

        for (int i = 0; i < n - 1; ++i) {
            int num = in.nextInt();
            arr[i] = new Value(num - prev);
            prev = num;
        }

        arr[n - 1] = new Value(0);

        SegmentTree segmentTree = new SegmentTree(arr);

        int q = in.nextInt();

        for (int i = 0; i < q; ++i) {
            switch (in.next()) {
                case "?":
                    int l = in.nextInt() - 1;
                    int r = in.nextInt() - 1;
                    //out.println(segmentTree.getLongest(l, r));
                    out.println(segmentTree.getLongest(l, r).getLongest() + 1);
                    break;
                case "+":
                    l = in.nextInt() - 1;
                    r = in.nextInt() - 1;
                    int num = in.nextInt();
                    if (l > 0) {
                        segmentTree.add(l - 1, new Value(num));
                    }
                    if (r < n - 1) {
                        segmentTree.add(r, new Value(-num));
                    }
                    break;
            }
        }
    }

    public void run() {
        try {
            in = new FastScanner(new File("atoms.in"));
            out = new PrintWriter(new File("atoms.out"));

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }

    public static void main(String[] arg) {
        new atoms_nb_java().run();
    }

    class Value {
        private int longest, lengthFromLeft, lengthFromRight, length;
        private long leftValue, rightValue;

        public Value() {
            this(0, 0, 0, 0, 0, 0);
        }

        public Value(long num) {
            leftValue = num;
            rightValue = num;
            longest = 0;
            lengthFromRight = 0;
            lengthFromLeft = 0;
            if (num == 1) {
                lengthFromLeft = 1;
                lengthFromRight = 1;
                longest = 1;
            }
            length = 1;
        }

        public Value(int longest, int lengthFromLeft, int lengthFromRight, int length, long leftValue, long rightValue) {
            //assert(longest <= length);
            this.longest = longest;
            this.lengthFromLeft = lengthFromLeft;
            this.lengthFromRight = lengthFromRight;
            this.length = length;
            this.leftValue = leftValue;
            this.rightValue = rightValue;
        }

        public Value add(Value v) {
            return new Value(Math.max(Math.max(this.longest, v.longest), (this.rightValue == v.leftValue ? this.lengthFromRight + v.lengthFromLeft : 0)),
                    this.lengthFromLeft + (this.rightValue == v.leftValue && this.length == this.lengthFromLeft ? v.lengthFromLeft : 0),
                    v.lengthFromRight + (this.rightValue == v.leftValue && v.length == v.lengthFromRight ? this.lengthFromRight : 0),
                    this.length + v.length,
                    this.leftValue,
                    v.rightValue);
        }

        public int getLongest() {
            return longest;
        }

        public long getValue() {
            return leftValue;
        }

        public int getLength() {
            return length;
        }

        public int getLengthFromRight() {
            return lengthFromRight;
        }
    }

    class SegmentTree {
        private final Value NONE = new Value(0, 0, 0, 0, 1, 1);

        private final int n;
        private Value[] tree;

        public SegmentTree(int n) {
            this.n = n;
            tree = new Value[4 * n];
            Arrays.fill(tree, new Value(0, 0, 0, 0, 0, 0));
        }

        public SegmentTree(Value[] array) {
            this(array.length);
            build(0, 0, n, array);
        }

        private void build(int v, int l, int r, Value[] a) {
            if (r - l == 1) {
                tree[v] = a[l];
            } else {
                //out.println(l + " " + r);
                int m = (l + r) / 2;
                build(2 * v + 1, l, m, a);
                build(2 * v + 2, m, r, a);
                tree[v] = tree[v * 2 + 1].add(tree[v * 2 + 2]);
            }
        }

        private int pos, from, to;
        private Value value;

        public void add(int pos, Value value) {
            this.pos = pos;
            this.value = value;
            _add(0, 0, n);
        }

        private void _add(int v, int l, int r) {
            if (r - l == 1) {
                long tmp = (long) (value.getValue() + tree[v].getValue());
                tree[v] = new Value(tmp);
            } else {
                int m = (l + r) / 2;
                if (pos < m) {
                    _add(2 * v + 1, l, m);
                } else {
                    _add(2 * v + 2, m, r);
                }
                tree[v] = tree[2 * v + 1].add(tree[2 * v + 2]);
            }
        }

        public Value getLongest(int from, int to) {
            this.from = from;
            this.to = to;
            return _getLongest(0, 0, n);
        }

        private Value _getLongest(int v, int l, int r) {
            if (r <= from || to <= l) {
                return NONE;
            }
            if (from <= l && r <= to) {
                return tree[v];
            }
            int m = (l + r) / 2;
            return _getLongest(2 * v + 1, l, m).add(_getLongest(2 * v + 2, m, r));
        }
    }
}