#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  vector<long long int> v(n);
  int i;
  int cnt1 = 0, cnt2 = 0, cnt0 = 0;
  for (i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] % 3 == 0)
      cnt0++;
    else if (v[i] % 3 == 1)
      cnt1++;
    else
      cnt2++;
  }
  int mn = min(cnt2, cnt1);
  cout << (cnt0 / 2) + mn;
  return 0;
}
