#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
mint po(mint a, int b) {
  mint ans = 1;
  for (int i = 0; i < b; i++) {
    ans *= a;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  mint ad = 0;
  int jou = 0;
  int f = 1;
  int s = 1;
  vector<vector<long long>> a(n, vector<long long>(61));
  vector<long long> len(n);
  for (int i = 0; i < n; i++) {
    long long p;
    long long lee = 0;
    cin >> p;
    int g = 0;
    while (p != 0) {
      if (p % 2)
        a[i][g] = 1;
      else
        a[i][g] = 0;
      lee++;
      g++;
      p /= 2;
    }
    len[i] = lee;
  }
  vector<long long> zero(61, 0);
  vector<long long> one(61, 0);
  for (int j = 0; j < 61; j++) {
    for (int i = 0; i < n; i++) {
      if (a[j][i] == 1)
        one[j]++;
      else
        zero[j]++;
    }
  }
  int y = 0;
  for (int i = 0; i < 61; i++) {
    ad += zero[i] * one[i];
  }
  cout << ad.x / 2 << endl;
  return 0;
}
