/**
 *   Author: Ridam Nagar
 *   Date: 03 February 2019
 *   Time: 11:37:06
**/
/*
package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{

    public static void main (String[] args) throws java.lang.Exception
    {        Scanner sc=new Scanner(System.in);
             int n=sc.nextInt();
             int arr[]=new int[n];
             int brr[]=new int[3];
             for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
             }
             int sum=0,count=0,k=0;
             Arrays.sort(arr);
             for(int i=0;i<n;i++){
                if(arr[i]==1){
                    brr[arr[i]]=brr[arr[i]] + 1;
                }
                if(arr[i]==2){
                    brr[arr[i]]=brr[arr[i]] + 1;

                }
             }
             if(brr[1]>brr[2]){

                int r=brr[1]-brr[2];
                int p=r/3;
                System.out.println(p+brr[2]);
             }else if(brr[1]<=brr[2] && brr[1]!=0){

                System.out.println(brr[1]);
             }else{
                System.out.println(0);
             }

    }
}


/**
 *   Author: Ridam Nagar
 *   Date: 03 February 2019
 *   Time: 11:37:06
**/
/*
package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{

    public static void main (String[] args) throws java.lang.Exception
    {        Scanner sc=new Scanner(System.in);
             int n=sc.nextInt();
             int arr[]=new int[n];
             int brr[]=new int[3];
             for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
             }
             int sum=0,count=0,k=0;
             Arrays.sort(arr);
             for(int i=0;i<n;i++){
                if(arr[i]==1){
                    brr[arr[i]]=brr[arr[i]] + 1;
                }
                if(arr[i]==2){
                    brr[arr[i]]=brr[arr[i]] + 1;

                }
             }
             if(brr[1]>brr[2]){

                int r=brr[1]-brr[2];
                int p=r/3;
                System.out.println(p+brr[2]);
             }else if(brr[1]<=brr[2] && brr[1]!=0){
                brr[2]=brr[2]-brr[1];
                System.out.println("brr:"+brr[2]);
             }else{
                System.out.println(0);
             }

    }
}


import java.util.Scanner;
public class splitting
{
    public static void main(String args[])
    {
        Scanner s= new Scanner(System.in);
        int n= s.nextInt();
        int a[]= new int[n];
        int i, t=0, x=0, y=0;
        for(i=0; i<n; i++)
        {
            a[i]= s.nextInt();
            if(a[i]==2)
            x++;
            if(a[i]==1)
            y++;
        }
        if(y==0)
        t=0;
        else if(x==0)
        t=y/3;
        else
        {
            if(x>=y)
            t=y;
            else
            t=((y-x)/3)+3;
        }
        System.out.println(t);
    }
}


import java.util.Scanner;
public class splitting
{
    public static void main(String args[])
    {
        Scanner s= new Scanner(System.in);
        int n= s.nextInt();
        int a[]= new int[n];
        int i, t=0, x=0, y=0;
        for(i=0; i<n; i++)
        {
            a[i]= s.nextInt();
            if(a[i]==2)
            x++;
            if(a[i]==1)
            y++;
        }
        if(y==0)
        t=0;
        else if(x==0)
        t=y/3;
        else
        {
            if(x>=y)
            t=y;
            else
            t=((y-x)/3)+x;
        }
        System.out.println(t);
    }
}


import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    int[] count = new int[3];
    for (int i = 0; i < n; i++) {
      int a = sc.nextInt();
      count[a]++;
    }

    sc.close();

    int answer = 0;

    if (count[2] == 0) {
      answer = count[1] / 3;
    } else if (count[2] <= count[1]) {
      answer = count[2];
      count[1] = count[1] - count[2];
      if (0 < count[1]) {
        answer += count[1] / 3;
      }
    } else {
      answer = count[1];
    }

    System.out.println(answer);

  }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;

public class Tmp {
  private static Reader reader = new InputStreamReader(System.in);
  private static Writer writer = new OutputStreamWriter(System.out);
  private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(reader));
  private static PrintWriter out = new PrintWriter(writer);

  private static int nextInt() throws IOException {
	in.nextToken();
	return (int) in.nval;
  }

  public static void main(String[] args) throws IOException {
//	final BufferedReader br = new BufferedReader(reader);
//	int n = Integer.valueOf(br.readLine());
//	final String s = br.readLine();

	int n = nextInt();
	int[] a = new int[n];
	for (int i = 0; i < n; i++) {
	  a[i] = nextInt();
	}

	out.println(solve(a));
	out.flush();
  }

  public static int solve(int[] a) {
	int ones = 0;
	int twos = 0;
	for (int i = 0; i < a.length; i++) {
	  if (a[i] == 1) {
		ones++;
	  } else {
		twos++;
	  }
	}
	if (ones == 0) {
	  return 0;
	}
	if (twos >= ones) {
	  return twos;
	}

	return twos + (ones - twos) / 3;
  }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;

public class Tmp {
  private static Reader reader = new InputStreamReader(System.in);
  private static Writer writer = new OutputStreamWriter(System.out);
  private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(reader));
  private static PrintWriter out = new PrintWriter(writer);

  private static int nextInt() throws IOException {
	in.nextToken();
	return (int) in.nval;
  }

  public static void main(String[] args) throws IOException {
//	final BufferedReader br = new BufferedReader(reader);
//	int n = Integer.valueOf(br.readLine());
//	final String s = br.readLine();

	int n = nextInt();
	int[] a = new int[n];
	for (int i = 0; i < n; i++) {
	  a[i] = nextInt();
	}

	out.println(solve(a));
	out.flush();
  }

  public static int solve(int[] a) {
	int ones = 0;
	int twos = 0;
	for (int i = 0; i < a.length; i++) {
	  if (a[i] == 1) {
		ones++;
	  } else {
		twos++;
	  }
	}
	if (ones == 0) {
	  return 0;
	}
	if (twos >= ones) {
	  return ones;
	}

	return twos + (ones - twos) / 3;
  }

}


import java.util.*;
import java.io.*;

		public class codeforces
		{
			public static void main(String[] args)
			{
				InputReader in = new InputReader(System.in);
				PrintWriter pw = new PrintWriter(System.out);

				int n = in.nextInt();
				int[] a = new int[3];

				for(int i=0;i<n;i++)
					a[in.nextInt()]++;

				int ans = 0, max = 0;

				ans = Math.min(a[1], a[2]);
				ans += (a[1] - ans)/3;

				max = a[1]/3;
				max += Math.min(a[1] - max*3, a[2]);

				ans = Math.max(max, ans);

				pw.println(ans);

				pw.flush();
				pw.close();
			}

			static class pair implements Comparable<pair>
			{
				Integer x, y;
				pair(int x,int y)
				{
					this.x=x;
					this.y=y;
				}

				public int compareTo(pair o) {
					int result = x.compareTo(o.x);
					if(result==0)
						result = y.compareTo(o.y);

					return result;
				}

				public String toString()
				{
					return x+" "+y;
				}

				public boolean equals(Object o)
				{
					if (o instanceof pair)
				    {
						pair p = (pair)o;
						return p.x == x && p.y == y ;
					}
					return false;
				}

				public int hashCode()
				{
					return new Long(x).hashCode()*31 + new Long(y).hashCode();
				}
			}

			static class InputReader
			{

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

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

				public int snext()
				{
					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 nextInt()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
				    {
						sgn = -1;
						c = snext();
					}
					int res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public long nextLong()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
					{
						sgn = -1;
						c = snext();
					}
					long res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} 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] = nextInt();
					}
					return a;
				}

				public String readString()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isSpaceChar(c));
					return res.toString();
				}

				public String nextLine()
				{
					int c = snext();
					while (isSpaceChar(c))
						c = snext();
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isEndOfLine(c));
					return res.toString();
				}

				public boolean isSpaceChar(int c)
				{
					if (filter != null)
						return filter.isSpaceChar(c);
					return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				}

				private boolean isEndOfLine(int c)
				{
					return c == '\n' || c == '\r' || c == -1;
				}

				public interface SpaceCharFilter
			    {
					public boolean isSpaceChar(int ch);
				}
			}

			static class CodeX {
	        public static void sort(long arr[]) {
	            merge_sort(arr, 0, arr.length - 1);
	        }

	        private static void merge_sort(long A[], long start, long end) {
	            if (start < end) {
	                long mid = (start + end) / 2;
	                merge_sort(A, start, mid);
	                merge_sort(A, mid + 1, end);
	                merge(A, start, mid, end);
	            }

	        }

	        private static void merge(long A[], long start,long mid, long end) {
	            long p = start, q = mid + 1;
	            long Arr[] = new long[(int)(end - start + 1)];
	            long k = 0;

	            for (int i = (int)start; i <= end; i++) {
	                if (p > mid)
	                    Arr[(int)k++] = A[(int)q++];

	                else if (q > end)
	                    Arr[(int)k++] = A[(int)p++];

	                else if (A[(int)p] < A[(int)q])
	                    Arr[(int)k++] = A[(int)p++];

	                else
	                    Arr[(int)k++] = A[(int)q++];
	            }
	            for (int i = 0; i < k; i++) {
	                A[(int)start++] = Arr[i];
	            }

	        }

	    }
		}


import java.util.*;
import java.io.*;

		public class codeforces
		{
			public static void main(String[] args)
			{
				InputReader in = new InputReader(System.in);
				PrintWriter pw = new PrintWriter(System.out);

				int n = in.nextInt();
				int[] a = new int[3];

				for(int i=0;i<n;i++)
					a[in.nextInt()]++;

				pw.println(Math.max(a[1]/3, Math.min(a[1], a[2])));

				pw.flush();
				pw.close();
			}

			static class pair implements Comparable<pair>
			{
				Integer x, y;
				pair(int x,int y)
				{
					this.x=x;
					this.y=y;
				}

				public int compareTo(pair o) {
					int result = x.compareTo(o.x);
					if(result==0)
						result = y.compareTo(o.y);

					return result;
				}

				public String toString()
				{
					return x+" "+y;
				}

				public boolean equals(Object o)
				{
					if (o instanceof pair)
				    {
						pair p = (pair)o;
						return p.x == x && p.y == y ;
					}
					return false;
				}

				public int hashCode()
				{
					return new Long(x).hashCode()*31 + new Long(y).hashCode();
				}
			}

			static class InputReader
			{

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

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

				public int snext()
				{
					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 nextInt()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
				    {
						sgn = -1;
						c = snext();
					}
					int res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}

				public long nextLong()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
					{
						sgn = -1;
						c = snext();
					}
					long res = 0;
					do
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} 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] = nextInt();
					}
					return a;
				}

				public String readString()
			    {
					int c = snext();
					while (isSpaceChar(c))
					{
						c = snext();
					}
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isSpaceChar(c));
					return res.toString();
				}

				public String nextLine()
				{
					int c = snext();
					while (isSpaceChar(c))
						c = snext();
					StringBuilder res = new StringBuilder();
					do
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isEndOfLine(c));
					return res.toString();
				}

				public boolean isSpaceChar(int c)
				{
					if (filter != null)
						return filter.isSpaceChar(c);
					return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				}

				private boolean isEndOfLine(int c)
				{
					return c == '\n' || c == '\r' || c == -1;
				}

				public interface SpaceCharFilter
			    {
					public boolean isSpaceChar(int ch);
				}
			}

			static class CodeX {
	        public static void sort(long arr[]) {
	            merge_sort(arr, 0, arr.length - 1);
	        }

	        private static void merge_sort(long A[], long start, long end) {
	            if (start < end) {
	                long mid = (start + end) / 2;
	                merge_sort(A, start, mid);
	                merge_sort(A, mid + 1, end);
	                merge(A, start, mid, end);
	            }

	        }

	        private static void merge(long A[], long start,long mid, long end) {
	            long p = start, q = mid + 1;
	            long Arr[] = new long[(int)(end - start + 1)];
	            long k = 0;

	            for (int i = (int)start; i <= end; i++) {
	                if (p > mid)
	                    Arr[(int)k++] = A[(int)q++];

	                else if (q > end)
	                    Arr[(int)k++] = A[(int)p++];

	                else if (A[(int)p] < A[(int)q])
	                    Arr[(int)k++] = A[(int)p++];

	                else
	                    Arr[(int)k++] = A[(int)q++];
	            }
	            for (int i = 0; i < k; i++) {
	                A[(int)start++] = Arr[i];
	            }

	        }

	    }
		}


import java.util.Scanner;

public class SPLIT {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int arr[] = new int[n];
		int ones=0;
		int twos=0;
		for(int i=0;i<n;i++) {
			arr[i]=sc.nextInt();
			if((arr[i]&1)==1)
				ones++;
			else
				twos++;
		}
		int teams=0;
		if(twos<=ones) {
			teams=twos;
			twos=twos-teams;
			ones=ones-teams;
		}
		else {
			teams=ones;
			twos=twos-teams;
			ones=ones-teams;
		}

		teams = teams+(ones/3);
		System.out.println(teams);
	}

}


import java.util.Scanner;

public class SPLIT {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int arr[] = new int[n];
		int ones=0;
		int twos=0;
		for(int i=0;i<n;i++) {
			arr[i]=sc.nextInt();
			if((arr[i]&1)==1)
				ones++;
			else
				twos++;
		}
		int teams=0;
		if(twos<=ones) {
			teams=twos;
			twos=twos-teams;
			ones=ones-teams;
		}

		teams = teams+(ones/3);
		System.out.println(teams);
	}

}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
    static final long MOD = (long)1e9+7;
    static FastReader in;
    public static void main(String[] args){
        in = new FastReader();
        int N = ni();
        int ans = 0, one = 0, two =0;
        while(N-->0){
            if(ni()==1)one++;
            else two++;
        }
        int t = Math.min(one,two);
        pn(t+(one-t)/3+(two-t)/3);
    }

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static long nl(){
        return Long.parseLong(in.next());
    }

    static double nd(){
        return Double.parseDouble(in.next());
    }

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
    static final long MOD = (long)1e9+7;
    static FastReader in;
    public static void main(String[] args){
        in = new FastReader();
        int N = ni();
        int ans = 0, one = 0, two =0;
        while(N-->0){
            if(ni()==1)one++;
            else two++;
        }
        int t = Math.min(one,two);
        pn(t+(one-t)/3);
    }

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static long nl(){
        return Long.parseLong(in.next());
    }

    static double nd(){
        return Double.parseDouble(in.next());
    }

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
public class sin {
public static void main(String args[]) {
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++)
		a[i]=s.nextInt();
	Arrays.sort(a);
	int sum=0,j=0,i=0;
	for( i=1;i<=n;i++) {
		if(a[i-1]==2)
			j++;
		else
		sum++;
	}

		int co=n-i+1;
		int ans=Math.min(j, sum);
		System.out.println(ans);

}
}


import java.util.*;
public class sin {
public static void main(String args[]) {
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++)
		a[i]=s.nextInt();
	Arrays.sort(a);
	int sum=0,j=0,i=0;
	for( i=1;i<=n;i++) {
		if(a[i-1]==2)
			j++;
		else
		sum++;
	}
   if(j==0) {
	   System.out.println(sum/3);
	   return;
   }
		int co=n-i+1;
		int ans=Math.min(j, sum);
		System.out.println(ans);

}
}


import java.util.*;
public class sin {
public static void main(String args[]) {
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++)
		a[i]=s.nextInt();
//	Arrays.sort(a);
	int sum=0,j=0,i=0;
	for( i=1;i<=n;i++) {
		if(a[i-1]==2)
			j++;
		else
		sum++;
	}
   if(j==0) {
	   System.out.println(sum/3);
	   return;
   }
		int co=n-i+1;
		int ans=Math.min(j, sum);
		System.out.println(ans);

}
}


import java.util.*;
public class sin {
public static void main(String args[]) {
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	int a[]=new int[n];
	for(int i=0;i<n;i++)
		a[i]=s.nextInt();
	//Arrays.sort(a);
	int sum=0,j=0,i=0;
	for( i=1;i<=n;i++) {
		if(a[i-1]==2)
			j++;
		else
		sum++;
	}
   if(j==0) {
	   System.out.println(sum/3);
	   return;
   }
		int co=n-i+1;
		int ans=Math.min(j, sum);
		int xx=sum-ans;
		xx/=3;
		ans+=xx;
		System.out.println(ans);

}
}


import java.util.*;
public class Main {

	public static void main(String args[] )  {

		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int[] a = new int[n];
		int c1=0,c2=0;
		for(int g=0;g<n;g++) {
			a[g]=in.nextInt();
			if(a[g]==1) {
				c1++;
			}
			else {
				c2++;
			}
		}
		int min=Math.min(c1, c2);
		int k=0;
		if(c2==0) {
			 k=c1/3;
		}

		System.out.println(min+k);
		in.close();
	}
}


import java.util.*;
public class Main {

	public static void main(String args[] )  {

		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int[] a = new int[n];
		int c1=0,c2=0;
		for(int g=0;g<n;g++) {
			a[g]=in.nextInt();
			if(a[g]==1) {
				c1++;
			}
			else {
				c2++;
			}
		}
		int min=Math.min(c1, c2);
		int k=0;

		if(c2==min) {
			 k=(c1-min)/3;
		}

		System.out.println(min+k);
		in.close();
	}
}


import java.util.*;
public class Main {

	public static void main(String args[] )  {

		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int[] a = new int[n];
		for(int g=0;g<n;g++) {
			a[g]=in.nextInt();
		}
		int count=0;
		for(int i=0;i<n-1;i++) {
			for(int  j=i+1;j<n;j++) {
				if(a[i]==1) {
					if(a[j]==2) {
						count++;
						a[i]=0;
						a[j]=0;
						break;
					}
					else {
						continue;
					}
				}
				if(a[i]==2) {
					if(a[j]==1) {
						count++;
						a[i]=0;
						a[j]=0;
						break;
					}
					else {
						continue;
					}

				}

			}

		}
		int c=0;
		for(int i=0;i<n;i++) {
			if(a[i]==1) {
				c++;
			}
		}
		int k=c/3;
		System.out.println(count+k);
		in.close();
	}
}


import java.awt.Point;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;

public class Main {
	//////
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	//////
	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	/////
	static long d(int x,int y){
		if(Math.abs(x-y)>1){
			return y-x;
		}else
			return 0;

	}

	static int closestSquare(int num){

		if(num==0){
			return -1;
		}
		int root=(int)Math.sqrt(num);
		int another=root+1;
		root=root*root;
		another=another*another;
		if(another-num>num-root){
			return num-root;
		}else
			return another-num;

	}

	public static void main(String[] args) throws IOException {

		FastReader scan = new FastReader();
		PrintWriter pw=new PrintWriter(System.out);

		int N=scan.nextInt();
		int[] A=new int[N];
		int one=0,two=0,count=0;
		for(int i=0;i<N;i++){
			A[i]=scan.nextInt();
			if(A[i]==1){
				one++;
			}else
				two++;

			if(one>=3){
				count++;
				one=one-3;
			}else if(two>=1&&one>=1){
				one--;two--;
				count++;
			}
		}

		System.out.println(count);
	}
}


import java.awt.Point;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;

public class Main {
	//////
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	//////
	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	/////
	static long d(int x,int y){
		if(Math.abs(x-y)>1){
			return y-x;
		}else
			return 0;

	}

	static int closestSquare(int num){

		if(num==0){
			return -1;
		}
		int root=(int)Math.sqrt(num);
		int another=root+1;
		root=root*root;
		another=another*another;
		if(another-num>num-root){
			return num-root;
		}else
			return another-num;

	}

	public static void main(String[] args) throws IOException {

		FastReader scan = new FastReader();
		PrintWriter pw=new PrintWriter(System.out);

		int N=scan.nextInt();
		int[] A=new int[N];
		int one=0,two=0,count=0;
		for(int i=0;i<N;i++){
			A[i]=scan.nextInt();
			if(A[i]==1){
				one++;
			}else
				two++;

		}
		while(one*1+two*2>=3){
		if(two>=1&&one>=1){
			one--;two--;
			count++;
		}else{
			break;
		}
		}
		while(one*1+two*2>=3){
		if(one>=3){
			count++;
			one=one-3;
		}else{
			break;
		}
		}
		System.out.println(count);
	}
}


import java.awt.Point;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;

public class Main {
	//////
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	//////
	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	/////
	static long d(int x,int y){
		if(Math.abs(x-y)>1){
			return y-x;
		}else
			return 0;

	}

	static int closestSquare(int num){

		if(num==0){
			return -1;
		}
		int root=(int)Math.sqrt(num);
		int another=root+1;
		root=root*root;
		another=another*another;
		if(another-num>num-root){
			return num-root;
		}else
			return another-num;

	}

	public static void main(String[] args) throws IOException {

		FastReader scan = new FastReader();
		PrintWriter pw=new PrintWriter(System.out);

		int N=scan.nextInt();
		int[] A=new int[N];
		for(int i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		int count=0,one=0,two=0;
		for(int i=0;i<N;i++){
			if(A[i]==1){
				if(one==0&&two==0){
					one++;
				}else if(one>=2&&two==0){
					one-=2;
					count++;
				}else if(one==0&&two>=1){
					two--;
					count++;
				}else{
					one++;
				}
			}else{
				if(two>=1&&one==0){
					two++;
				}else if(two==0&&one>=1){
					count++;
					one--;
				}else{
					two++;
				}
			}
		}

		System.out.println(count);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class SplittingInTeams {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        String[] line = br.readLine().split(" ");
        int twos = 0, ones = 0, group = 0;

        for (int i = 0; i < line.length; i++) {
            if(line[i].equals("2"))
                twos++;
            else
                ones++;
        }

        if(ones >= twos){

            group = twos + ((ones - twos)/3);
        }
        else if (ones > 0 && ones < twos){

            group = ones;
        }

        System.out.println(group);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class SplittingInTeams {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        String[] line = br.readLine().split(" ");
        int twos = 0;
        int ones = 0;
        int group = 0;

        for (int i = 0; i < n; i++) {

            if(line[i].equals("2"))
                twos++;
            else
                ones++;
        }

        if(ones > twos){

            group = twos + ((ones - twos)/3);
        }
        else if (ones > 0 && ones < twos){

            group = ones;
        }

        System.out.println(group);
    }

}


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

// array, remove first element, copyOfRange
// array, remove last element, copyOf

/*

case-1: 1 1 1
case-2: 2 1

idea: just check for two cases (and priority for case 2)

1 1 1 2 2

2 2 2 2 1 1

*/

public class R452A {

    FastScanner sc;
    PrintWriter out;

    // case: 1 1 1
    public boolean check(int[] arr) {
        int n = arr.length;
        Arrays.sort(arr);
        if (n >= 3) {
            if (arr[0]==1 && arr[1] == 1 && arr[2] == 1) return true;

        }
        return false;
    }

    // case: 1 2
    public boolean check2(int[] arr) {
        int n = arr.length;
        Arrays.sort(arr);
        if (arr[0] == 1 && arr[n-1] == 2) return true;

        return false;
    }

    public void solve()  {
        int n = sc.nextInt();
        int[] a = new int[n];

        for (int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }

        int res = 0;

        while(check2(a)) {
            a = Arrays.copyOfRange(a, 1, a.length);
            a = Arrays.copyOf(a, a.length-1);

            res++;
        }

        while(check(a)) {
            a = Arrays.copyOfRange(a, 3, a.length);
            res++;
        }

        System.out.println(res);

    }

    private void run() {
        //sc = new FastScanner(new File("input.txt"));
         sc = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        //int test = 1;
        //for (int i=1; i<=test; i++) {
            //System.out.println("test #" + i);
            solve();
            //System.out.println();
        //}

        out.close();
    }

   public static void main(String[] args) {
        new R452A().run();
    }

    private class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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


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

// array, remove first element, copyOfRange
// array, remove last element, copyOf

/*

case-1: 1 1 1
case-2: 2 1

idea: just check for two cases (and priority for case 2)

1 1 1 2 2

2 2 2 2 1 1

*/

public class R452A {

    FastScanner sc;
    PrintWriter out;

    // case: 1 1 1
    public boolean check(int[] arr) {
        int n = arr.length;
        Arrays.sort(arr);
        int cnt1 = 0;
        int[] res = new int[11111];

        for (int i=0; i<n; i++) {
            if (arr[i] == 1) {
                cnt1++;
            }

        }

        if (cnt1 >= 3) {
            return true;
            // remove three 1
            //res = Arrays.copyOfRange(arr, 3, arr.length);
        }

        return false;
    }

    // case: 1 2
    public boolean check2(int[] arr) {
        int n = arr.length;
        Arrays.sort(arr);
        int cnt1 = 0;
        int cnt2 = 0;
        int[] res = new int[11111];

        for (int i=0; i<n; i++) {
            if (arr[i] == 2) cnt2++;
            if (arr[i] == 1) cnt1++;
        }

        if (cnt1 >= 1 && cnt2 >= 1) {
            return true;
            //res = Arrays.copyOfRange(arr, 1, arr.length);
            //res = Arrays.copyOf(res, res.length-1);
        }

        return false;
    }

    public void solve()  {
        int n = sc.nextInt();
        int[] a = new int[n];

        for (int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }

        int res = 0;

        while(check2(a)) {
            a = Arrays.copyOfRange(a, 1, a.length);
            a = Arrays.copyOf(a, a.length-1);

            res++;
        }

        while(check(a)) {
            a = Arrays.copyOfRange(a, 3, a.length);
            res++;
        }

        System.out.println(res);

    }

    private void run() {
        //sc = new FastScanner(new File("input.txt"));
         sc = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        //int test = 1;
        //for (int i=1; i<=test; i++) {
            //System.out.println("test #" + i);
            solve();
            //System.out.println();
        //}

        out.close();
    }

   public static void main(String[] args) {
        new R452A().run();
    }

    private class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author tmdautov
 */
public class Hello {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TeamSplitting solver = new TeamSplitting();
        solver.solve(1, in, out);
        out.close();
    }

    static class TeamSplitting {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int[] a = new int[n];
            int cnt1 = 0, cnt2 = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();

                if (a[i] == 1) cnt1++;
                if (a[i] == 2) cnt2++;
            }

            int res = 0;
            if (cnt1 > cnt2) {
                res = cnt2 + (cnt1 - cnt2) / 3;
                System.out.println(res);
                return;
            }

            System.out.println(cnt2);

        }

    }
}


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

// array, remove first element, copyOfRange
// array, remove last element, copyOf

/*

case-1: 1 1 1
case-2: 2 1

idea: just check for two cases (and priority for case 2)

1 1 1 2 2

2 2 2 2 1 1

*/

public class R452A {

    FastScanner sc;
    PrintWriter out;

    // case: 1 1 1
    public boolean check(int[] arr) {
        int n = arr.length;
        Arrays.sort(arr);
        if (n >= 3) {
            if (arr[0]==1 && arr[1] == 1 && arr[2] == 1) return true;

        }
        return false;
    }

    // case: 1 2
    public boolean check2(int[] arr) {
        int n = arr.length;
        Arrays.sort(arr);
        if (arr[0] == 1 && arr[n-1] == 2) return true;

        return false;
    }

    public void solve()  {
        int n = sc.nextInt();
        int[] a = new int[n];

        int cnt1 = 0;
        int cnt2 = 0;
        int res = 0;

        for (int i=0; i<n; i++) {
            a[i] = sc.nextInt();

            if (a[i] == 1) cnt1++;
            if (a[i] == 2) cnt2++;
        }

        if (cnt1 == 0) {
            System.out.println(0);
            return;
        }
        //System.out.println(cnt1 + " " + cnt2);

        // case: 2 1
        if (cnt1 > 0 && cnt2 > 0) {
            while (cnt1 > 0 && cnt2 > 0) {
                res++;
                cnt1--; cnt2--;

            }

        }

        // case: 1 1 1
        if (cnt1 >= 3 && cnt2 == 0) {
            while (cnt1 >= 3) {
                res++;
                cnt1--;

            }
        }

        /*
        int res = 0;

        while(check2(a)) {
            a = Arrays.copyOfRange(a, 1, a.length);
            a = Arrays.copyOf(a, a.length-1);

            res++;
        }

        while(check(a)) {
            a = Arrays.copyOfRange(a, 3, a.length);
            res++;
        }*/

        System.out.println(res);

    }

    private void run() {
        // sc = new FastScanner(new File("input.txt"));
         sc = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        //int test = 1;
        //for (int i=1; i<=test; i++) {
            //System.out.println("test #" + i);
        long startTime = System.currentTimeMillis();
            solve();
        long finishTime = System.currentTimeMillis();
        //System.out.println(finishTime - startTime);
            //System.out.println();
        //}

        out.close();
    }

   public static void main(String[] args) {
        new R452A().run();
    }

    private class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author tmdautov
 */
public class Hello {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TeamSplitting solver = new TeamSplitting();
        solver.solve(1, in, out);
        out.close();
    }

    static class TeamSplitting {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int[] a = new int[n];
            int cnt1 = 0, cnt2 = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();

                if (a[i] == 1) cnt1++;
                if (a[i] == 2) cnt2++;
            }

            int res = 0;
            if (cnt1 > cnt2) {
                res = cnt2 + (cnt1 - cnt2) / 3;
                System.out.println(res);
                return;
            }

            System.out.println(cnt1);

        }

    }
}


import java.util.*;
public class Q1
{
	public static void main(String args[])
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int arr[]=new int[n];
		int none=0,ntwo=0,gr1=0,gr2=0,i;
		for(i=0;i<n;i++)
		{
			arr[i]=s.nextInt();
			if(arr[i]==1)
				none++;
			else
				ntwo++;
		}
		if(none!=0&&ntwo!=0)
		gr1=ntwo+(none-ntwo)/3;
		gr2=none/3;
		if(gr1>gr2)
			System.out.println(gr1);
		else
			System.out.println(gr2);

}
}


import java.util.*;
public class Q1
{
	public static void main(String args[])
	{
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int arr[]=new int[n];
		int none=0,ntwo=0,gr1=0,gr2=0,i;
		for(i=0;i<n;i++)
		{
			arr[i]=s.nextInt();
			if(arr[i]==1)
				none++;
			else
				ntwo++;
		}
		if(none!=0&&ntwo!=0)
		{if(none>ntwo)
		gr1=ntwo+(none-ntwo)/3;
	else
		gr1=none;
		}
		gr2=none/3;
		if(gr1>gr2)
			System.out.println(gr1);
		else
			System.out.println(gr2);

}
}


import java.util.Scanner;

public class SplittinginTeams {
    public static void main (String args[]){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),tmp,som=0;
        int a[]=new int[2];
        for(;n>0;n--){
            tmp=sc.nextInt();
            a[tmp-1]++;

        }

        if(a[0]%3!=0){
            while (a[1]!=0&&a[0]!=0){
                som+=1;
                a[0]--;
                a[1]--;
            }
        }
        if(a[0]%3==0){
            som+=a[0]/3;
            a[0]=0;
        }
        System.out.println(som);
    }
}


import java.util.Scanner;

public class SplittinginTeams {
    public static void main (String args[]){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),tmp,som=0;
        int a[]=new int[2];
        for(;n>0;n--){
            tmp=sc.nextInt();
            a[tmp-1]++;

        }

        while (a[1]!=0&&a[0]!=0){
            som+=1;
            a[0]--;
            a[1]--;
        }
        while (a[0]>2){
            som+=1;
            a[0]-=3;
        }
        System.out.println(som);
    }
}


/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class A
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         int oc = 0;
         int tc = 0;
         for(int x: arr)
         {
            if(x == 1)
               oc++;
            else
               tc++;
         }
         int res = Math.min(oc, tc);
         oc -= Math.min(oc,tc);
         res += oc/3;
         System.out.println(res);
      }
   }


//package javaapplication1;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import static java.lang.reflect.Array.set;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;
import sun.awt.HKSCS;

/*
    AUTHOR GEORGE
*/
public class Main {
       public static class number{
       private int num;
       private int index;

       }
        public static void main(String[] args) throws IOException{
        BufferedReader BR=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter PW=new PrintWriter(new PrintStream(System.out));
        In IN=new In(BR);
        Out OUT=new Out(PW);
        Scanner SC=new Scanner(System.in);
        //Functions F=new Functions();
        //QuickSort QS=new QuickSort();
        //BinarySearch BS=new BinarySearch();
        int n=Integer.parseInt(BR.readLine());
        String [] input=BR.readLine().split(" ");
        int onee=0,two=0;
        for (int i = 0; i < input.length; i++) {
            if(input[i].equals("1"))
                ++onee;
            else
                ++two;

        }
        int ans=0;
        ans+=Math.min(onee, two);
        onee-=two;
        if(onee>0)
            ans+=onee/3;
        System.out.print(ans);

    }
    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");
        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

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

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

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }
    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
    public static class QuickSort{
    protected static int [] intArray;
    protected static long [] longArray;
    protected static double [] DoubleArray;
    protected static char [] charArray;
    protected static int Size;
        public QuickSort() {
        }

    protected static int partition(int arr[],int low,int high)
    {
      int pivot=arr[high];
      int i=low-1;
      int temp=0;
        for (int j = low; j < high; ++j) {
            if(arr[j]<=pivot)
            {
                 ++i;
                 temp = arr[i];
                 arr[i] = arr[j];
                 arr[j] = temp;
            }
        }
         temp = arr[i+1];
         arr[i+1] = arr[high];
         arr[high] = temp;
         return i+1;

    }
    protected static int partition(long arr[],int low,int high)
    {
      long pivot=arr[high];
      int i=low-1;
      long temp=0;
        for (int j = low; j < high; ++j) {
            if(arr[j]<=pivot)
            {
                 ++i;
                 temp = arr[i];
                 arr[i] = arr[j];
                 arr[j] = temp;
            }
        }
         temp = arr[i+1];
         arr[i+1] = arr[high];
         arr[high] = temp;
         return i+1;

    }
    protected static int partition(double arr[],int low,int high)
    {
      double pivot=arr[high];
      int i=low-1;
      double temp=0;
        for (int j = low; j < high; ++j) {
            if(arr[j]<=pivot)
            {
                 ++i;
                 temp = arr[i];
                 arr[i] = arr[j];
                 arr[j] = temp;
            }
        }
         temp = arr[i+1];
         arr[i+1] = arr[high];
         arr[high] = temp;
         return i+1;

    }
    protected static void sort(int arr[],int low, int high)
    {
          if(low < high)
          {
              int pi=partition(arr, low, high);
              sort(arr, low, pi-1);
              sort(arr, pi+1, high);

          }

    }
   protected static void sort(long arr[],int low, int high)
    {
          if(low < high)
          {
              int pi=partition(arr, low, high);
              sort(arr, low, pi-1);
              sort(arr, pi+1, high);

          }
    }

    protected static void sort(double arr[],int low, int high)
    {
          if(low < high)
          {
              int pi=partition(arr, low, high);
              sort(arr, low, pi-1);
              sort(arr, pi+1, high);

          }
    }
    protected  static void printArray(int arr[])
    {
        int n = arr.length;
        for (int i=0; i<n; ++i)
            System.out.print(arr[i]+" ");
        System.out.println();
    }

  }
    public static class Functions{

        public Functions() {
        }
        protected static boolean [] sieveOfEratosthenesPrimes(int limit){
        boolean prime[] = new boolean[limit+1];
        for(int i=0;i<limit;i++)
            prime[i] = true;
        for(int p = 2; p*p <=limit; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == true)
            {
                // Update all multiples of p
                for(int i = p*2; i <= limit; i += p)
                    prime[i] = false;
            }
        }
         return prime;
    }
    protected static boolean checkAnagram(String str1, String str2) {
        int i=0;
        for (char c : str1.toCharArray()) {
        i = str2.indexOf(c, i) + 1;
        if (i <= 0) { return false; }
    }
    return true;
    }

    protected static long NCR(long N, long R){
    if(N < R)
        return 0;
    if(R == 0 || R == N)
        return 1;
    return NCR(N-1,R-1)+NCR(N-1,R);
    }
    protected static long NCR(int N, int R){
    if(N < R)
        return 0;
    if(R == 0 || R == N)
        return 1;
    return NCR(N-1,R-1)+NCR(N-1,R);
    }
    protected static String changeCharInPosition(int position, char ch, String str){
    char[] charArray = str.toCharArray();
    charArray[position] = ch;
    return new String(charArray);
    }
    protected static boolean isPrime(long n) {
    if(n < 2) return false;
    if(n == 2 || n == 3) return true;
    if(n%2 == 0 || n%3 == 0) return false;
    long sqrtN = (long)Math.sqrt(n)+1;
    for(long i = 6L; i <= sqrtN; i += 6) {
        if(n%(i-1) == 0 || n%(i+1) == 0) return false;
    }
    return true;
    }
    protected static boolean isPrime(int n) {
    if(n < 2) return false;
    if(n == 2 || n == 3) return true;
    if(n%2 == 0 || n%3 == 0) return false;
    int sqrtN = (int)Math.sqrt(n)+1;
    for(long i = 6L; i <= sqrtN; i += 6) {
        if(n%(i-1) == 0 || n%(i+1) == 0) return false;
    }
    return true;
    }
 }
  public static class BinarySearch{
        private static int middle;
        private static int L;
        private static int R;
        public BinarySearch() {

        }
        protected static int Search(int [] arr,int element){
         R=arr.length-1;
         L=0;
         return BS(arr, L, R, element);
        }
        protected static int Search(long [] arr,long element){
         R=arr.length-1;
         L=0;
         return BS(arr, L, R, element);
        }
        protected static int Search(char [] arr,char element){
         R=arr.length-1;
         L=0;
         return BS(arr, L, R, element);
        }
        protected static int Search(double [] arr,double element){
         R=arr.length-1;
         L=0;
         return BS(arr, L, R, element);
        }
         protected static int BS(int [] arr,int L,int R,int element){
          if(R>=L)
          {
            middle=L+(R-L)/2;
            if(arr[middle]==element)
            {
                return middle;
            }
            else if(arr[middle]>element)
            {
                return BS(arr, L,middle-1, element);
            }
            else
            {
                return BS(arr, middle+1, R, element);
            }
          }
          else
            {
              return -1;
            }
          }
         protected static int BS(long [] arr,int L,int R,long element){
          if(R>=L)
          {
            middle=L+(R-L)/2;
            if(arr[middle]==element)
            {
                return middle;
            }
            else if(arr[middle]>element)
            {
                return BS(arr, L,middle-1, element);
            }
            else
            {
                return BS(arr, middle+1, R, element);
            }
          }
          else
            {
              return -1;
            }
          }
         protected static int BS(char [] arr,int L,int R,char element){
          if(R>=L)
          {
            middle=L+(R-L)/2;
            if(arr[middle]==element)
            {
                return middle;
            }
            else if(arr[middle]>element)
            {
                return BS(arr, L,middle-1, element);
            }
            else
            {
                return BS(arr, middle+1, R, element);
            }
          }
          else
            {
              return -1;
            }
          }
         protected static int BS(double [] arr,int L,int R,double element){
          if(R>=L)
          {
            middle=L+(R-L)/2;
            if(arr[middle]==element)
            {
                return middle;
            }
            else if(arr[middle]>element)
            {
                return BS(arr, L,middle-1, element);
            }
            else
            {
                return BS(arr, middle+1, R, element);
            }
          }
          else
            {
              return -1;
            }
          }
    }

}


//package javaapplication1;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Main {

    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(new PrintStream(System.out));
        int n=Integer.parseInt(br.readLine());
        String [] input=br.readLine().split(" ");
        int one=0,two=0;
        for (int i = 0; i < input.length; i++) {
            if(input[i].equals("1"))
                ++one;
            else
                ++two;

        }
        int ans=0;
        ans+=Math.min(one, two);
        one-=two;
        if(one>0)
            ans+=one/3;
        System.out.print(ans);
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
public class A452 {

  public void solve() throws IOException {
    int n = ni();
    HashMap<Integer, Integer> h = new HashMap();
    for (int i = 0; i < n; i++) {
      int curr = ni();
      if (!h.containsKey(curr))
        h.put(curr, 1);
      else
        h.put(curr, h.get(curr) + 1);
    }
    if (h.size() == 2) {
      System.out.println(Math.min(h.get(1), h.get(2)));
    } else {
       if (h.containsKey(2)) {
         System.out.println(0);
         return;
       } else {
         System.out.println(h.get(1) / 3);
         return;
       }
    }
  }

  public BufferedReader br;
  public StringTokenizer st;
  public PrintWriter out;

  public String nextToken() throws IOException {
    while(st == null || !st.hasMoreTokens())
      st = new StringTokenizer(br.readLine());
    return st.nextToken();
  }

  public String nextLine() throws IOException {
    return br.readLine();
  }

  public int ni() throws IOException {
    return Integer.parseInt(nextToken());
  }

  public long nl() throws IOException {
    return Long.parseLong(nextToken());
  }

  public double nd() throws IOException {
    return Double.parseDouble(nextToken());
  }

  public void run() throws IOException {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    solve();
  }

  public static void main(String args[]) throws IOException {
    new A452().run();
  }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
public class A452 {

  public void solve() throws IOException {
    int n = ni();
    HashMap<Integer, Integer> h = new HashMap();
    for (int i = 0; i < n; i++) {
      int curr = ni();
      if (!h.containsKey(curr))
        h.put(curr, 1);
      else
        h.put(curr, h.get(curr) + 1);
    }
    if (h.size() == 2) {
      int min = Math.min(h.get(1), h.get(2));
      System.out.println(min + (h.get(1) - min) / 3);
    } else {
       if (h.containsKey(2)) {
         System.out.println(0);
         return;
       } else {
         System.out.println(h.get(1) / 3);
         return;
       }
    }
  }

  public BufferedReader br;
  public StringTokenizer st;
  public PrintWriter out;

  public String nextToken() throws IOException {
    while(st == null || !st.hasMoreTokens())
      st = new StringTokenizer(br.readLine());
    return st.nextToken();
  }

  public String nextLine() throws IOException {
    return br.readLine();
  }

  public int ni() throws IOException {
    return Integer.parseInt(nextToken());
  }

  public long nl() throws IOException {
    return Long.parseLong(nextToken());
  }

  public double nd() throws IOException {
    return Double.parseDouble(nextToken());
  }

  public void run() throws IOException {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    solve();
  }

  public static void main(String args[]) throws IOException {
    new A452().run();
  }
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
public class Hello
{

	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		//String s = sc.nextLine();
		//String p = sc.nextLine();
		//int n = p.length();
		//int arr[]= preProcess(p);
		//System.out.println(n);
		int i=0;
		int ans = 0;
		int c0 = 0;
		int c1 = 0;
		for(i=0;i<n;i++){
			int  num = sc.nextInt();
			if(num == 2)
				c0++;
			else
				c1++;
		}
		if(c0=<c1){
			ans = c0;
			ans += (c1-c0)/3;
		}else{
			ans = c1;
		}
		System.out.println(ans);
	}
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
public class Hello{

	public static void main (String[] args) throws java.lang.Exception{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		//String s = sc.nextLine();
		//String p = sc.nextLine();
		//int n = p.length();
		//int arr[]= preProcess(p);
		//System.out.println(n);
		int i=0;
		int ans = 0;
		int c0 = 0;
		int c1 = 0;
		for(i=0;i<n;i++){
			int  num = sc.nextInt();
			if(num == 2)
				c0++;
			else
				c1++;
		}
		if(c0<=c1){
			ans = c0;
			ans += (c1-c0)/3;
		}else
			ans = c1;

		System.out.println(ans);
	}
}


package onlineContest;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int o = 0, t = 0;
		for (int i = 0; i < n; i++) {
			if (input.nextInt() == 1) {
				o++;
			} else {
				t++;
			}
		}
		int result = 0;
		result = Math.min(o, t);
		if (o > t) {
			result += (o - t) / 3;
		}

		System.out.println(result);

		input.close();
	}

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int o = 0, t = 0;
		for (int i = 0; i < n; i++) {
			if (input.nextInt() == 1) {
				o++;
			} else {
				t++;
			}
		}
		int result = 0;
		result = Math.min(o, t);
		if (o > t) {
			result += (o - t) / 3;
		}

		System.out.println(result);

		input.close();
	}

}


import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int[] aa = new int[n];

		for(int i=0;i<n;i++){
           aa[i] = sc.nextInt();
		}
        int i=0;
        int j=n-1;
        int c=0;
        int ti=-1;
        int tj=-1;
        int sum=0;
		while(i<j){
           if(ti!=i && tj!=j){
           	 sum = aa[i]+aa[j];
           }
		   else if(ti!=i){
             sum += aa[i];
		   }
		   else if(tj!=j){
		   	 sum += aa[j];
		   }
		   ti=i;
		   tj=j;
           if(sum==3){
           	 c++;
           	 i++;
           	 j--;
           }
           else if(sum<3){
              i++;
           }
           else{
           	  i++;
           	  j--;
           }
		}

		System.out.println(c);
	}
}


import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int[] aa = new int[n];

		for(int i=0;i<n;i++){
           aa[i] = sc.nextInt();
		}
		Arrays.sort(aa);
        int i=0;
        int j=n-1;
        int c=0;
        int ti=-1;
        int tj=-1;
        int sum=0;
		while(i<j){
           if(ti!=i && tj!=j){
           	 sum = aa[i]+aa[j];
           }
		   else if(ti!=i){
             sum += aa[i];
		   }
		   else if(tj!=j){
		   	 sum += aa[j];
		   }
		   ti=i;
		   tj=j;
           if(sum==3){
           	 c++;
           	 i++;
           	 j--;
           }
           else if(sum<3){
              i++;
           }
           else{
           	  i++;
           	  j--;
           }
		}

		System.out.println(c);
	}
}


import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ameera
 * Codeforces 899A
 */
public class splittingOnTeams {
    public static void main (String[] args){
        Scanner in = new Scanner (System.in);

        long n = in.nextInt();
        long ones = 0;
        long twos = 0;
        long t = 0;

        for (int i = 0; i < n; i++) {
            if(in.nextInt()==1){
                ones++;
            }
            else{
                twos++;
            }
        }

        if(ones>=twos){
            ones-=twos;
            t+=twos;
        }
        t+=ones/3;

        System.out.println(t);
    }

}


import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Ameera Codeforces 899A
 */
public class splittingOnTeams {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        long n = in.nextInt();
        long ones = 0;
        long twos = 0;
        long t = 0;

        for (int i = 0; i < n; i++) {
            if (in.nextInt() == 1) {
                ones++;
            } else {
                twos++;
            }
        }

        while (ones < twos && twos > 0) {
            twos--;
        }
        if (ones >= twos) {
                ones -= twos;
                t += twos;
            }

        t += ones / 3;

        System.out.println(t);
    }

}


import java.util.*;
import java.io.*;

public final class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter pw = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());

        st = new StringTokenizer(br.readLine());
        int twoCount = 0;
        int oneCount = 0;
        while(n-->0){
            int a = Integer.parseInt(st.nextToken());
            twoCount += a == 2 ? 1 : 0;
            oneCount += a == 1 ? 1 : 0;
        }

        int result = 0;
        result += Math.min(twoCount, oneCount);
        oneCount-=result;
        result+=(oneCount/3);
        System.out.println(result);
    }
}


import java.util.*;
import java.io.*;

public final class Main {

    public static void main(String[] args) throws Exception {
        PrintWriter pw = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());

        st = new StringTokenizer(br.readLine());
        int twoCount = 0;
        int oneCount = 0;
        while(n-->0){
            int a = Integer.parseInt(st.nextToken());
            twoCount += a == 2 ? 1 : 0;
            oneCount += a == 1 ? 1 : 0;
        }

        int result = 0;
        result += Math.max(Math.min(twoCount, oneCount), oneCount/3);
        System.out.println(result);
    }
}


import java.util.*;
import java.io.*;
import java.math.*;

    public  class Sample implements Runnable
    {

          public static void solve()
          {
             int n=i();
             //int
             int[] a=new int[n];
             int count_1=0,count_2=0;
             for(int i=0;i<n;i++)a[i]=i();
             for(int i=0;i<n;i++)
              {
                if(a[i]==1)count_1++;
                if(a[i]==2)count_2++;
              }
              if(count_1>=count_2)out.println(count_2+(long)Math.floor((count_1-count_2)/3));
              else out.println(count_1);

          }
          public static int upperbound(int[] a,int low,int high,int key)
          {

            while(low<high)
            {
              int mid=(low+high)>>1;
              if(a[mid]>key)
              {
                high=mid;
              }
              else
              {
                low=mid+1;
              }
            }
            return low;
          }
          public static int lowerbound(int[] a,int low,int high,int key)
          {
            while(low<high)
            {
              int mid=(low+high)>>1;
              if(a[mid]>=key)
              {
                high=mid;
              }
              else
              {
                low=mid+1;
              }
            }
            return low;
          }

static int findMin(int arr[], int n)
{

    int sum = 0;
    for (int i = 0; i < n; i++)
        sum += arr[i];

    boolean[][] dp=new boolean[n+1][sum+1];

    for (int i = 0; i <= n; i++)
        dp[i][0] = true;

    for (int i = 1; i <= sum; i++)
        dp[0][i] = false;

    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=sum; j++)
        {

            dp[i][j] = dp[i-1][j];

            if (arr[i-1] <= j)
                dp[i][j] |= dp[i-1][j-arr[i-1]];
        }
    }

    int diff = Integer.MAX_VALUE;

    for (int j=sum/2; j>=0; j--)
    {
        if (dp[n][j] == true)
        {
            diff = sum-2*j;
            break;
        }
    }
    return diff;
}

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;

            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

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

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

          public int snext()
         {
                  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 nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } 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] = nextInt();
                  }
                  return a;
          }

          public long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(c));
                  return res.toString();
          }

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }


import java.util.*;
import java.io.*;
import java.math.*;

    public  class Sample implements Runnable
    {

          public static void solve()
          {
             int n=i();
             int[] a=new int[n];
             int count_1=0,count_2=0;
             for(int i=0;i<n;i++)a[i]=i();
             for(int i=0;i<n;i++)
              {
                if(a[i]==1)count_1++;
                if(a[i]==2)count_2++;
              }
              if(count_1>=count_2)out.println(count_2+(long)Math.floor((count_1-count_2)/3));
              else out.println(count_1);

          }
          public static int upperbound(int[] a,int low,int high,int key)
          {

            while(low<high)
            {
              int mid=(low+high)>>1;
              if(a[mid]>key)
              {
                high=mid;
              }
              else
              {
                low=mid+1;
              }
            }
            return low;
          }
          public static int lowerbound(int[] a,int low,int high,int key)
          {
            while(low<high)
            {
              int mid=(low+high)>>1;
              if(a[mid]>=key)
              {
                high=mid;
              }
              else
              {
                low=mid+1;
              }
            }
            return low;
          }

static int findMin(int arr[], int n)
{

    int sum = 0;
    for (int i = 0; i < n; i++)
        sum += arr[i];

    boolean[][] dp=new boolean[n+1][sum+1];

    for (int i = 0; i <= n; i++)
        dp[i][0] = true;

    for (int i = 1; i <= sum; i++)
        dp[0][i] = false;

    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=sum; j++)
        {

            dp[i][j] = dp[i-1][j];

            if (arr[i-1] <= j)
                dp[i][j] |= dp[i-1][j-arr[i-1]];
        }
    }

    int diff = Integer.MAX_VALUE;

    for (int j=sum/2; j>=0; j--)
    {
        if (dp[n][j] == true)
        {
            diff = sum-2*j;
            break;
        }
    }
    return diff;
}

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;

            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

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

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

          public int snext()
         {
                  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 nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } 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] = nextInt();
                  }
                  return a;
          }

          public long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(c));
                  return res.toString();
          }

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }