Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to the sum of elements in the second part. It is not always possible, so Vasya will move some element before dividing the array (Vasya will erase some element and insert it into an arbitrary position).

Inserting an element in the same position he was erased from is also considered moving.

Can Vasya divide the array after choosing the right element to move and its new position?

Input

The first line contains single integer n (1 ≤ n ≤ 100000) — the size of the array.

The second line contains n integers a1, a2... an (1 ≤ ai ≤ 109) — the elements of the array.

Output

Print YES if Vasya can divide the array after moving one element. Otherwise print NO.

Examples

Input

3
1 3 2


Output

YES


Input

5
1 2 3 4 5


Output

NO


Input

5
2 2 3 4 5


Output

YES

Note

In the first example Vasya can move the second element to the end of the array.

In the second example no move can make the division possible.

In the third example Vasya can move the fourth element by one position to the left.
/**
 * @author prakhar28
 *
 */
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;


import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class Main{
	
	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[200005]; // line length+1
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
 
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
	
	static class FastScanner {

	    private final BufferedReader bufferedReader;
	    private StringTokenizer stringTokenizer;

	    public FastScanner() {
	        bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	    }

	    public String next() {
	        while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
	            try {
	                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException("Can't read next value", e);
	            }
	        }
	        return stringTokenizer.nextToken();
	    }

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

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public double nextDouble() {
	        return Double.parseDouble(next());
	    }

	    public String nextLine(){
	        String str = "";
	        try {
	            str = bufferedReader.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	    }
	}
	
	static void closeall() throws IOException{
		printWriter.close();
		sc.close();
		in.close();
	}
	static Scanner sc = new Scanner(System.in);
	static Reader in = new Reader();
	static FastScanner fastScanner = new FastScanner();
	static PrintWriter printWriter = new PrintWriter(new BufferedOutputStream(System.out));
	static BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
	static long INF = (long)(1e18);

	
	int V,E;
	ArrayList<Integer> adj[];
	ArrayList<Integer> path;
	Main(){
	}
	Main(int v,int e){
		V=v;
		E=e;
		adj=new ArrayList[v];
		path = new ArrayList<>();
		for(int i=0;i<v;i++)
			adj[i] = new ArrayList<>();
	}
	void addEdge(int u,int v){
		adj[u].add(v);
		adj[v].add(u);
	}
	
	
	static long power(long a,long k)
	{
		long m = 1000000007;
	    long ans=1;
	    long tmp=a%m;
	    while(k>0)
	    {
	        if(k%2==1)
	        	ans=ans*tmp%m;
	        tmp=tmp*tmp%m;
	        k>>=1;
	    }
	    return ans;
	}
	
	static class Pair /*implements Comparable<Pair>*/{
		long F,S;
		Pair(long x,long y){
			F = x;
			S = y;
		}
		/*public int compareTo(Pair ob){
			return this.num-ob.num;
		}*/
		
	}
	static long gcd(long a,long b) {
		if(a<b) {
			long t = a;
			a = b;
			b = t;
		}
		long r = a%b;
		if(r==0)
			return b;
		return gcd(b,r);
	}
	
	static int lower_bound(int[] a,int low,int high,int val) {
		while(low!=high) {
			int mid = (low+high)/2;
			if(a[mid]<val)
				low=mid+1;
			else
				high=mid;
		}
		return low;
	}
	
	static int max(int a,int b) {
		return (int)Math.max(a, b);
	}
	static long max(long a,long b) {
		return (long)Math.max(a, b);
	}
	static long min(long a,long b) {
		if(a<b)
			return a;
		return b;
	}
	static long mod = 1000000007;
	
	public static void main(String args[])throws IOException{
		Reader in = new Reader();
		int n = in.nextInt();
		long[] a = new long[n];
		for(int i=0;i<n;i++)
			a[i] = in.nextLong();
		int k = -1;
		HashMap<Long,Integer> map = new HashMap<>();
		for(int i=0;i<n;i++) {
			if(map.get(a[i])==null)
				map.put(a[i], ++k);
		}
		ArrayList<Integer> pos[] = new ArrayList[k+1];
		for(int i=0;i<k+1;i++)
			pos[i] = new ArrayList<>();
		for(int i=0;i<n;i++) {
			int idx = map.get(a[i]);
			pos[idx].add(i);
		}
		long[] sum = new long[n];
		sum[0]=a[0];
		boolean ans = false;
		int low,high,mid;
		for(int i=1;i<n;i++)
			sum[i]=sum[i-1]+a[i];
		for(int i=0;i<n-1;i++) {
			long s1=sum[i];
			long s2=sum[n-1]-sum[i];
			if(s1==s2) {
				ans=true;
				break;
			}
			if(s1>s2) {
				long d = s1-s2;
				if(d%2==1)
					continue;
				d/=2;
				if(map.get(d)==null)
					continue;
				int val = map.get(d);
				low = 0; high = pos[val].size()-1;
				while(low!=high) {
					mid = (low+high)/2;
					if(pos[val].get(mid)<=i)
						low=mid+1;
					else
						high=mid;
				}
				if(pos[val].get(low)<=i || low>0 && pos[val].get(low-1)<=i) {
					ans = true;
					break;
				}
			}
			if(s2>s1) {
				long d = s2-s1;
				if(d%2==1)
					continue;
				d/=2;
				if(map.get(d)==null)
					continue;
				int val = map.get(d);
				low = 0; high = pos[val].size()-1;
				while(low!=high) {
					mid = (low+high)/2;
					if(pos[val].get(mid)<=i)
						low=mid+1;
					else
						high=mid;
				}
				if(pos[val].get(low)>i) {
					ans = true;
					break;
				}
			}
		}
		if(!ans && sum[n-1]%2==0) {
			long val = sum[n-1]/2;
			for(int i=0;i<n;i++) {
				if(val==a[i]) {
					ans=true;
					break;
				}
			}
		}
		if(ans)
			printWriter.println("YES");
		else
			printWriter.println("NO");
		closeall();
	}
} 