#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  long long int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  for (long long int p = 0; p < n; p++) {
    cin >> arr[p];
    if (arr[p] % 3 == 0) {
      cnt3 += 1;
    } else if (arr[p] % 3 == 1) {
      cnt1 += 1;
    } else
      cnt2 += 1;
  }
  long long int ans = ((cnt3) / 2) + min(cnt1, cnt2);
  cout << ans;
}
