#include <bits/stdc++.h>
using namespace std;
const int N = 8e8;
int n, a, ans;
;
int arr[110];
vector<int> ve;
int sum(int x) {
  int ret = 0;
  while (x) {
    ret += (x % 10);
    x /= 10;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &a);
    int x = sum(a);
    ++arr[x];
    ve.push_back(x);
  }
  for (int i = 1; i <= 100; ++i) {
    if (arr[i] == 0) continue;
    for (int j = 1; j <= 100; ++j) {
      if (arr[j] == 0) continue;
      if ((i + j) % 3 == 0) {
        if (i == j) {
          if (arr[i] == 1) continue;
          if (arr[i] % 2 == 0) {
            ans += arr[i] / 2;
            arr[i] = 0;
          } else {
            ans += arr[i] / 2;
            arr[i] = 1;
          }
        } else {
          if (arr[i] >= arr[j]) {
            ans += arr[j];
            arr[i] -= arr[j];
            arr[j] = 0;
          } else {
            ans += arr[i];
            arr[j] -= arr[i];
            arr[i] = 0;
          }
        }
      }
    }
  }
  cout << ans;
  return 0;
}
