#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count = 0;
  int arr[3] = {0};
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    arr[a % 3]++;
  }
  int ans = (arr[0] / 2) + min(arr[1], arr[2]);
  cout << ans << endl;
  return 0;
}
